World leaders have committed to ending all foreign meddling in Libya's war and to uphold a weapons embargo at a Berlin summit, as part of a broader plan to end the spiralling conflict.

The presidents of Russia, Turkey and France were among global chiefs signing up to the plan to stop interfering in the war - be it through weapons, troops or financing.

But the talks failed to deliver "serious dialogue" between the warring parties - strongman Khalifa Haftar and the head of Tripoli's UN-recognised government Fayez al-Sarraj - or to get both sides to sign up to a permanent truce.

"We have a very disparate situation in Libya, where ensuring that a ceasefire is immediately respected is simply not easy to guarantee," said summit host Chancellor Angela Merkel.

"But I hope that through today's conference, we have a chance the truce will hold further."

US Secretary of State Mike Pompeo acknowledged that there are "still some questions on how well and effectively" the commitments can be monitored. 

But he said he is "optimistic that there will be less violence and ... an opportunity to begin the conversation that (UN special envoy) Ghassan Salame has been trying to get going between the Libyan parties".

Libya has been torn by fighting between rival armed factions since a 2011 NATO-backed uprising killed dictator Moamer Kadhafi.

Most recently, Mr Sarraj's troops in Tripoli have been under attack since April from Mr Haftar's forces.

Clashes have killed more than 280 civilians and 2,000 fighters and displaced tens of thousands, until a fragile ceasefire backed by both Ankara and Moscow was put in place on January 12.

Although Mr Sarraj's government is recognised by the UN, powerful players have broken away to stand behind Mr Haftar - turning a domestic conflict into what some have described as a proxy war in which international powers jostle to secure their own interests.

International alarm grew in recent weeks after Turkey ordered in troops to shore up Mr Sarraj's government.

Chancellor Angela Merkel welcomes world leaders to the talks in Berlin

For UN chief Antonio Guterres, the Libya conflict had spiralled to dangerous proportions in the last days.

"Until now we have an escalation of the Libya conflict with some foreign interference. Now we are facing the risk of a true regional escalation. And that risk was averted in Berlin," he noted, adding that world powers have made "a strong commitment to stop" the perilous spiral. 

Russian Foreign Minister Sergei Lavrov pointed to some positive takeaways from the Berlin pow-wow, but said the summit failed to launch necessary talks between Mr Sarraj and Mr Haftar.

"It is clear that we have not yet succeeded in launching a serious and stable dialogue between them," Mr Lavrov told reporters after the Berlin conference, where Mr Haftar and Mr Sarraj did not meet face to face. 

Nevertheless, the Libyan parties had taken "a small step" forward, Mr Lavrov added.

Pro-Haftar forces upped the ante on the eve of the talks by blocking oil exports at Libya's key ports, crippling the country's main income source in protest at Turkey's decision to send troops to shore up Mr Sarraj's Tripoli-based Government of National Accord (GNA).

Ahead of the talks, Turkish President Recep Tayyip Erdogan lashed out at Mr Haftar, saying he needed to drop his "hostile attitude" if Libya is to have any chance at winning peace.

Khalifa Haftar (R) arrives in Berlin last night

The flaring oil crisis underlined the devastating impact of foreign influence in the conflict, in which Mr Sarraj's GNA is backed by Turkey and Qatar while Mr Haftar has the support of Russia, Egypt and the United Arab Emirates.

Russia has been accused of sending in mercenaries to help Mr Haftar as Moscow seeks to extend its influence in the region - allegations it denies.

For Turkey, the fall of Mr Sarraj's GNA could jeopardise a maritime boundary agreement the parties signed. It gives Ankara extensive rights over the eastern Mediterranean where the recent discovery of undersea gas reserves has triggered a scramble by littoral states. 

Mr Erdogan has repeatedly urged Europe to stand united behind Mr Sarraj's government, warning that Tripoli's fall could allow jihadist groups like the Islamic State or Al-Qaeda to regroup.

Further unrest could prompt a new wave of migrants to head for Europe, he has cautioned.

Amid the latest apparent ceasefire violation in which GNA forces on Sunday accused Mr Haftar's militia of opening fire on them in southern Tripoli, Mr Sarraj issued a plea for international "protection troops".

The call echoed a similar suggestion by the EU's chief diplomat Josep Borrell, who stressed that monitors must be present to check that any ceasefire and weapons embargo are respected.

With the idea gathering pace, Britain and Italy had voiced readiness to help, ahead of a EU foreign ministers' meeting that will discuss how the bloc can contribute to implementing Sunday's deal.

But as Mr Guterres noted, that discussion remains premature.

"First, we need to have a ceasefire - we cannot monitor something that doesn't exist."