PALERMO, Italy (Reuters) - Libya’s two main rival leaders met for the first time in more than five months at a conference hosted by Italy on Tuesday and the prime minister endorsed a United Nations plan for an election next year.

Italy's Prime Minister Giuseppe ConteÊwelcomes Libyan military commander Khalifa Haftar as he arrives at the venue of the international conference on Libya in Palermo, Italy, November 12, 2018. REUTERS/Guglielmo Mangiapane

More than seven years after long-serving dictator Muammar Gaddafi was toppled by Western-backed rebels with NATO air support, no central authority has asserted control over oil-producing Libya and armed groups control the streets.

That Tuesday’s meeting in Palermo, Sicily took place at all could be seen as a success in a fraught diplomatic environment in which factions on the ground in Libya and their foreign allies have rarely seen eye to eye.

In a sign of the tense atmosphere, the Turkish delegation stormed out early, complaining of being excluded from a meeting.

Libyan Prime Minister Fayez al-Serraj, whose weak but internationally recognized government is based in the country’s west, met Khalifa Haftar, the military strongman who rules most of the east of the North African state.

Italian Prime Minister Giuseppe Conte and U.N. Libya envoy Ghassan Salame, speaking at a joint news conference, said the Palermo gathering was a step forward for a U.N. plan to hold elections in 2019 after a national constitutional conference.

“Haftar knows the action plan and is committed to the national conference,” Salame said. “I think every Libyan now knows that there is not a third way. Either the political process moves forward or new clashes could take place anytime.”

There were no announcements of diplomatic breakthroughs. But Serraj’s spokesman said on Twitter the prime minister was committed to a U.N. road map to hold an election in the spring after a constitutional framework is put in place.

A previous U.N. plan for elections next month was shelved last week.

A draft communique, reviewed by Reuters, said Libyan delegations had agreed to prepare for the election by spring 2019 and abide by the results.

An Italian diplomat said Haftar had given his backing for Serraj to remain in office as prime minister until the election can be held. “You don’t change the horse until you cross the river,” the diplomat quoted Haftar as saying.

GROUP HANDSHAKE

Despite Haftar having said he would not participate in the conference, photos showed him with Serraj and Italian Prime Minister Giuseppe Conte embracing and smiling in a three-way handshake. The Libyan rivals were also pictured with dignitaries including Egyptian President Abdel Fattah al-Sisi, European Union Council President Donald Tusk, Russian Prime Minister Dmitry Medvedev and French Foreign Minister Jean-Yves Le Drian.

Slideshow ( 9 images )

However, Haftar skipped the official final summit photo, as did his foreign ally Sisi.

Conte told reporters it had been important to invite all Libyan players. He said he was sorry that the Turkish delegation had walked out the conference, blaming regional “sensitivities” which he did not specify.

Turkish Vice President Fuat Oktay said earlier that Turkey had walked out with “deep disappointment” after apparently being excluded from events. “Any meeting which excludes Turkey would prove to be counter-productive for the solution of this problem,” he said.

The United Nations has blamed a recent spike in violence in Libya for its decision to drop plans to hold an election next month. While aiming for an election next year, U.N. officials say Libyans should first decide what sort of vote they want.

Italy, the former colonial power which has large oil and gas interests in Libya and has been working to halt people-smuggling from the Libyan coast across the Mediterranean, had called the summit in a bid to bring together Libya’s competing factions.

Haftar, a former officer in Gaddafi’s military who lived for years in exile in the United States, has emerged as the leader of the most powerful armed faction, having defeated Islamist militants in the east with support from Egypt and Arab states.

Serraj, heading the government in the west, has struggled to exert control beyond the capital Tripoli. Rival parliaments in the east and west also claim legitimacy as the legislature for the entire country.