A Libyan military commander waging an offensive to capture the capital Tripoli is committed to a ceasefire, Germany's foreign minister said on Thursday, in an apparent advance for efforts to end a near-decade of turmoil in the North African country.

The minister, Heiko Maas, added that commander Khalifa Haftar is also willing to attend a conference in Berlin on Sunday aimed at addressing the conflict, the foreign ministry said, after Mass visited the eastern Libyan city of Benghazi.

More:

Haftar's office was not immediately available for comment.

But informed sources in the Greek capital Athens said Haftar was expected to have talks there on Friday with Greece's prime minister and foreign minister during a stopover on his way to Berlin.

Maas's comment follows failed efforts by Russia and Turkey to persuade Haftar on a visit to Moscow this week to agree to a lasting ceasefire and halt the offensive on the Libyan capital. Haftar left Moscow without signing the proposal.

The nine-month-old war over Tripoli is just the latest bout of chaos in Libya, an OPEC oil exporter that has become a hub for human traffickers to ship migrants by boats to Italy, while fighters have exploited the widespread disorder.

Germany will host a summit on Sunday, bringing together foreign powers and the Libyan rival camps backed by them to try end the war over Tripoli and resume talks over a power-sharing deal.

Maas flew to Haftar's base in eastern Libya on Thursday to discuss the Berlin summit.

"General Haftar has signalled his readiness to contribute to the success of the Libya Conference in Berlin and is willing to participate. He has repeated his commitment to observe the existing ceasefire," the ministry tweeted Maas as saying after meetings in Benghazi.

German Chancellor Angela Merkel welcomed the development and said one aim of the Berlin conference would to be to get back to a weapons embargo.

"At the Libya conference we must above all see that the weapons embargo is adhered to again, which is basically agreed by the UN but unfortunately not honoured," she told reporters.

Libya has been fractured and deeply unstable, with outside powers providing support to rival factions, since veteran dictator Muammar Gaddafi was toppled in a 2011 uprising.

Turkey backs Serraj's government, while Haftar has received support from Egypt, the United Arab Emirates, Jordan and Russian mercenaries.

Turkey steps up war of words

Turkey has begun to send troops into Libya in support of the internationally recognised government in Tripoli, President Recep Tayyip Erdogan said earlier on Thursday.

"In order for the legitimate government in Libya to remain standing and for stability to be established, we are now sending our soldiers to this country," Erdogan told an event in Ankara.

Erdogan warned on Tuesday that Turkey would not refrain from "teaching a lesson" to Haftar's eastern Libyan forces if their attacks against the GNA continue. The talks in Moscow were the latest attempt to stabilise Libya, which has the largest proven reserves of oil in Africa.

Turkey and Libya signed two agreements in November, one on military cooperation and another on maritime boundaries in the eastern Mediterranean. Erdogan said Turkey will quickly start granting licences for exploration and drilling in the region.

"In the areas that remain between Turkey and Libya, it is now legally impossible for there to be exploration and drilling activities or a pipeline without the approval of both sides," he said.