GENEVA — Libya’s two main warring factions agreed to a cease-fire on Friday, raising hopes for an end to years of bloody turmoil that have drawn in military forces from Russia, Turkey and other regional powers.
The two sides signed the agreement at the United Nations in Geneva at the end of a weeklong meeting of delegates from the internationally recognized Government of National Accord, which is based in the capital Tripoli, and the self-styled Libyan National Army led by Khalifa Hifter and based in the country’s east.
The two sides agreed a complete, countrywide and permanent agreement with immediate effect, said Stephanie Williams, the United Nations acting special envoy who was chairwoman of the most recent talks. She said it called for frontline forces to return to their bases and for the withdrawal of all foreign forces and mercenaries within three months.
“God willing, it will be the key to peace and security in all Libya,” Col. Abu Ali Abushama, the head of the government delegation, said at the signing ceremony.
Libya has a long history of failed peace initiatives and the reaction of the foreign sponsors that have driven the long-running war, on both sides of the conflict, will be crucial to the success of the cease-fire.
The former U.N. envoy, Ghassan Salame, quit his job earlier this year, partly in exasperation at the failure of the international community to provide meaningful support for peace efforts in Libya.
Mr. Salame has been vocal about his disillusionment with the open meddling by some foreign countries in Libya, such as Russia, Turkey and the United Arab Emirates, combined with the failures of Western countries like the United States, France and Britain to meaningfully counter that meddling.
The latest agreement comes four months after Mr. Hifter’s forces were forced into a humiliating retreat from their positions around the capital, Tripoli, which they had mounted a bitter, 15-month campaign to capture. Although the assault ended in failure, it drew powerful foreign actors ever deeper in the war for control of the oil-rich North African nation.
Russia sent mercenaries and the United Arab Emirates shipped vast amounts of weaponry in support of Mr. Hifter. On the other side, Turkey intervened decisively on the side of the beleaguered Tripoli government, sending military advisers, drones and Syrian mercenaries.
For months, the two sides have been engaged in a tense standoff around Surt, in central Libya, where the country’s longtime dictator Col. Muammar el-Qaddafi was born and died violently in 2011. Surt is the gateway to a region known as the oil crescent, where most of Libya’s oil production takes place.
Mr. Hifter halted most oil production in January in an effort to starve the Tripoli government of funds. But production has risen sharply in recent weeks, to 300,000 barrels a day, amid wider expectations that the blockade would be lifted.
Although Mr. Hifter remains the leader of a powerful military coalition, his political strength has steadily diminished since his forces were routed from Tripoli in June. On his home turf in eastern Libya, other powerful political players have emerged in recent months and grown close to some of Mr. Hifter’s foreign allies, notably Egypt.
In his first interview after resigning from the envoy job, Mr. Salame accused the U.N. Security Council of hypocrisy, saying the majority of its members had initially supported Mr. Hifter’s assault on Tripoli and actively stymied his own peace efforts.
Mr. Salame said he had been “stabbed in the back” by those same countries in the interview with The Mediator’s Studio, a podcast of the Oslo Forum, an organization that promotes conflict mediation.
Ms. Williams described the accord reached on Friday as “a moment that will go down in history,” praising the courage, commitment and professionalism of the delegates in forging the deal.
She said it also set an exceptional example for Libyan politicians who now face the challenge of converting the cease-fire into a broader political settlement.
Nick Cumming-Bruce reported from Geneva and Declan Walsh from Nairobi, Kenya.