Libya's opposing governments have committed to a conditional ceasefire following talks in France.
UN-backed Prime Minister Fayez al-Sarraj and Khalifa Haftar, the rival military commander who controls the east, met in Paris on Tuesday.
They are aiming to end the conflict which has engulfed the country since Col Muammar Gaddafi was ousted in 2011.
French President Emmanuel Macron said the rivals could soon be seen as symbols of Libya's reconciliation.
"We commit to a ceasefire and to refrain from any use of armed force for any purpose that does not strictly constitute counter-terrorism," they said in a joint, 10-point statement.
The document also pledged to move towards holding elections - which could take place as early as 2018 - and "building the rule of law" in a country struggling to control the armed groups which have stepped into the power vacuum left by the Gaddafi regime.
Mr Sarraj's Government of National Accord (GNA), which is backed by the UN and based in the capital Tripoli, has tried to win the support of the various militias and politicians since coming to power in 2016.
But Gen Haftar's self-styled Libyan National Army (LNA), based in Tobruk, 1,000km (620 miles) to the east, refuses to recognise the GNA. Gen Haftar is leading the battle against Islamist militants, and recently declared victory in Benghazi, the country's second city.
Talks earlier this year failed to result in a joint statement. However, the two men shook each others' hands following this latest round, which was chaired by the UN's envoy to Libya, Ghassan Salame.
"The cause of peace has made a lot of progress today," Mr Macron told reporters gathered at the chateau outside of Paris, praising the leaders' "historic courage". "The Mediterranean [region] needs this peace."
Mr Macron and other European leaders had been hoping for some sort of agreement today, as Libya has become a key route for migrants making their way to Europe.
Tens of thousands of people have set off from its coast in hope of reaching Europe this year alone, with many men, women and children drowning in the attempt.
Mr Macron said he hoped this agreement would be a blow to the human traffickers who work in the region.