Libya: From war and chaos to possible peace
From last year's push to seize the Libyan capital Tripoli by military strongman Khalifa Haftar to hopes of peace, we look at events that led to Friday's agreement to hold elections.
Libya, which sits atop Africa's largest proven crude oil reserves, plunged into violence after a 2011 NATO-backed uprising toppled and killed longtime dictator Moamer Kadhafi.
Here is a recap of events since 2019:
On April 4, 2019, General Haftar orders his troops to advance on Tripoli, seat since 2016 of the UN-recognised Government of National Accord (GNA) which he claims is backed by "terrorist" groups.
Haftar supports a parallel administration based in the eastern city of Tobruk. His forces already control the main oil fields in the south.
On April 19, US President Donald Trump recognises Haftar's "significant role in fighting terrorism and securing Libya's oil resources".
In a major blow to the general, GNA forces retake the town of Gharyan on June 26, the main supply base for Haftar's forces southwest of the capital.
On November 5, the New York Times reports that Russia has sent mercenaries to support Haftar. Moscow denies the claim.
At the end of November, Turkey and the GNA sign a security deal with President Recep Tayyip Erdogan, who later sends Turkish troops in support.
A UN report meanwhile accuses several countries -- including Turkey -- of breaking an 2011 arms embargo on the country.
While Turkey and Qatar support the GNA, Haftar is backed by Egypt, the United Arab Emirates, Saudi Arabia and Jordan.
Turkey and Russia broker a ceasefire that comes into effect on January 12 2020, after months of fighting outside Tripoli.
GNA chief Fayez al-Sarraj signs the deal, but Haftar leaves Moscow the next day without doing so. Fighting continues.
On January 18, forces allied with Haftar block oil exports from key Mediterranean terminals, paralysing Libya's main economic lifeline.
The next day, at a summit in Berlin, world leaders commit to ending all foreign meddling.
But UN envoy Ghassan Salame resigns on March 2, saying the agreement is being flouted.
A UN report in May confirms the presence of Russian mercenaries to back Haftar working for Wagner, the security group said to be close to President Vladimir Putin.
Turkey meanwhile admits to sending Syrian fighters, to prop up the GNA.
Russian mercenaries begin withdrawing from around Tripoli.
On April 13 the tide begins to turn against Haftar, when GNA forces capture two key coastal cities west of Tripoli -- Sorman and Sabratha.
On May 18, pro-GNA fighters retake the Al-Watiya airbase, and then three other military bases south of the capital.
By early June they have retaken the west of the country, and begin to threaten the strategic city of Sirte.
The UN said it is "horrified" by reports of mass graves in Tarhouna, Haftar's last bastion in the west to fall to pro-GNA units.
On June 20 Egypt warns that it will intervene if the GNA tries to take Sirte.
After two rounds of peace talks in Morocco between the two sides, a "consensus" begins to emerge in early October after Haftar lifts his blockade on oil fields and ports.
Oil begins to flow again.
On October 23 a "permanent ceasefire" is announced after five days of talks in Geneva.
In early November, rival military officers began talks on home soil for the first time to hammer out a road map for the practical implementation of the ceasefire.
In Tunisia, at UN-supported political talks on Friday, an agreement to hold elections in December 2021 is sealed.