CAIRO — The Libyan commander backed by Russia, whose forces suffered a string of battlefield losses in recent days, declared on Saturday that he was ready to stop fighting and enter talks to end his oil-rich country’s grinding civil war.
The announcement was unlikely to bring an immediate end to the fighting. But it offered new evidence of the decisive clout of Turkey, on the other side of Libya’s war, whose intervention in favor of the U.N.-backed government in Tripoli has thwarted Russia’s ambitions and shifted the course of the conflict.
The Libyan commander, Khalifa Hifter, made the cease-fire offer in Cairo as he stood alongside his Egyptian ally, President Abdel Fattah el-Sisi. Egypt, along with Russia and the United Arab Emirates, have invested heavily in supporting Mr. Hifter and are now scrambling to limit his losses after the dramatic collapse of his 14-month campaign to capture Tripoli.
The scale and speed of Mr. Hifter’s losses have stunned Libyans, and analysts say the retreat not only marks the end of his assault on Tripoli, but is likely to reshape the broader military and political landscape in the country.
“All of our bearing points are changing,” said Tarek Megerisi, an analyst with the European Council on Foreign Relations. “It’s very unclear what things will look like once the dust settles. But this is Hifter on the ropes. It’s the first time we’ve seen him make any compromise or concession since he returned to Libya in 2014.”
Libya, which has Africa’s largest oil reserves, has been mired in chaos since the ouster of its longtime dictator, Colonel Muammar el-Qaddafi, by an American-backed coalition during the Arab Spring in 2011. An eruption of fighting between Libyan factions in 2014 quickly escalated into a regional proxy war fueled by foreign powers that poured arms, money and mercenaries into the fight.
Over the years, the country became divided between east and west, with Mr. Hifter based in his eastern stronghold in the city of Benghazi. The United Nations-backed government is based in Tripoli, in the west.
President Recep Tayyib Erdogan of Turkey deployed a warship, armed drones and thousands of Turkish-funded Syrian fighters in January to push back Mr. Hifter’s assault on Tripoli. The Turkish-backed forces have scored a string of major victories in recent days, routing Mr. Hifter’s forces entirely from western Libya and driving them hundreds of miles to the east.
After capturing Tripoli’s international airport earlier in the week, government fighters captured Tarhuna, Mr. Hifter’s last stronghold in western Libya, on Friday. Fleeing fighters left behind helicopters, expensive Russian-built weapons systems and large stores of ammunition.
By Saturday evening, government forces had reached the edge of the city of Surt, 230 miles east of Tripoli, where heavy fighting erupted. Government fighters were hit by airstrikes from drones and warplanes. At least 19 government fighters were killed, according to Libyan news reports.
In the south, oil production restarted at the giant Sharara oil field after Mr. Hifter’s forces deserted it, Reuters reported.
The main question now, said Wolfram Lacher, an analyst at the German Institute for International and Security Affairs, “is what the Russians will do.”
Hundreds of Russian mercenaries employed by the Wagner Group, a Kremlin-linked private military company that played a critical role in the Tripoli offensive, have retreated to the relative safety of a Hifter-controlled air base.
The Russians could use their air power to prevent the government advance from reaching a crescent-shaped stretch of coastline that is the center of Libya’s oil industry and currently controlled by Mr. Hifter.
Another possibility, Mr. Lacher said, is that the putative cease-fire announced in Cairo could be a pretext for Egyptian airstrikes or other military action in support of Mr. Hifter next week.
“I see this as a warning to the government forces that Egypt will enforce red lines if they don’t stop their advance,” he said. “The Egyptians would want to keep the oil crescent under Hifter’s control.”
The battlefield developments mark a dramatic reversal of fortunes of Mr. Hifter, 76, a former C.I.A. asset.
Since launching his first offensive in 2014, Mr. Hifter has developed a reputation as a truculent, iron-fisted commander who spurned politics, played his foreign allies against each other, and regularly boasted of his intention to seize power by force.
But he cut a chastened figure in Cairo on Saturday as he stood meekly beside Mr. el-Sisi, proposing to implement a cease-fire that would start on Monday morning.
In his remarks, Mr. Hifter railed against what he called “Turkish colonizers” and appealed for all foreign fighters and foreign-supplied weapons to be sent out of Libya — a striking call given how heavily Mr. Hifter has relied on outside arms, men and money to mount his doomed assault on Tripoli.
His assault on Tripoli was going well, with Russia’s help, until January, when Turkey intervened to save the ailing Tripoli government. Mr. Erdogan stepped into the fray for a mix of commercial and geostrategic reasons.
Before agreeing to deploying his military, he signed a deal with the Tripoli government to give him greater rights in the eastern Mediterranean, a hub of natural gas exploration. But the Libyan war also offered him a chance to back against his great regional rival, the United Arab Emirates.
The impact was felt in a matter of months.
Turkish officers deployed to Libya to impose order on the ill-disciplined government forces, while the battle-hardened Syrian fighters reinforced the front lines in the southern Tripoli suburbs. Turkish drones pummeled Mr. Hifter’s supply lines and, in one day in late May, destroyed several Emirati-funded Russian air defense systems.
Analysts say Turkey and Russia are likely to shy away from direct clashes between their forces in Libya, and could yet do a deal over Libya.
Another possibility is that Mr. Hifter will face a challenge at his base in eastern Libya, where he has ruthlessly sidelined rivals for years.
“There are so many forces and players,” Mr. Lacher said. “Some Hifter loyalists might see an opportunity to improve their position. Others have been alienated or exiled outside eastern Libya and might see a chance to get back at him. It’s quite a combustible mix.”
The main factor keeping such forces in check, he added, “is fear of the instability that would come with Hifter’s demise.”