Libya’s two main rival leaders have agreed to call a conditional ceasefire and hold elections early next year.

The diplomatic breakthrough followed talks in Paris hosted by Emmanuel Macron.

The French president said Libya’s UN-backed prime minister, Fayez al-Sarraj and General Khalifa Haftar had displayed “historic courage”.

The deal marks a step towards a political settlement aimed at ending years of violence on Europe’s doorstep.

“This process is essential for the whole of Europe, because if we don’t succeed, the terror risk and the migratory consequences that such a failure would produce, would have direct consequences for our countries,” Macron said.

Libya has been in turmoil since its former leader Colonel Gaddafi was ousted in 2011.

For now, General Haftar’s Libyan National Army, which controls large tracts of the east of the country, has so far refused to recognise the UN-backed Government of National Accord based in Tripoli.

Haftar’s forces have won a string of military victories leaving them in control of key ports and the city of Benghazi.