Leaders of the two main factions in war-torn Libya have agreed to implement a ceasefire and to hold elections next year after French-brokered talks which Emmanuel Macron hailed as “historic”.

Fayez al-Sarraj, the head of Libya’s UN-backed government in western Libya, and General Khalifa Haftar, a military strongman in the country’s east, shook hands and pledged to try to work together after talks outside Paris.

Mr Macron, who has made peace in Libya a foreign policy priority, said the two men had shown “historic courage” during the talks.

“The cause of peace has made a lot of progress today,” the French president said in the suburb of La Celle-Saint-Cloud. “The Mediterranean needs this peace.”

Behind the smiles and diplomatic handshakes, there is still much work to do to try to reunite Libya, which remains in a state of political chaos six years after the overthrow of Muammar Gaddafi.