Libyan strongman Khalifa Haftar has agreed to abide by a ceasefire and said he was ready to participate in an international conference in Berlin on Sunday, Germany's foreign minister said.
Libya's UN-recognised government in Tripoli has been under attack since April from Haftar's forces, with clashes killing more than 280 civilians and 2,000 fighters and displacing tens of thousands.
The leaders of the North African state's warring factions were in Moscow early this week at talks aimed at finalising a ceasefire orchestrated by Russia and Turkey.
"During my visit to Libya today, General Haftar made clear: He wants to contribute to the success of the Libyan conference in Berlin and is in principle ready to participate in it. He has agreed to abide by the ongoing ceasefire," German Foreign Minister Heiko Maas tweeted after talks in Benghazi.
After the Moscow talks, Haftar had walked away without signing the permanent truce, sparking fears about the shaky ceasefire.
Maas had travelled to meet Haftar in the eastern Libyan city of Benghazi -- one of the general's strongholds -- in a bid to persuade him to join in the peace initiative.
Battle for Tripoli
The trip came days after Maas spoke with Haftar's rival Fayez al-Sarraj, who serves as head of the UN-recognised government in Tripoli.
Separately in Tripoli, Sarraj announced he would attend the Berlin talks held under the auspices of the United Nations.
The battle over Tripoli is the latest unrest to wrack Libya since a 2011 NATO-backed uprising killed dictator Moamer Kadhafi. Since then, Libya has been caught up in fighting between rival armed factions, including Islamist militants.
In his report to the UN Security Council late on Wednesday, UN chief Antonio Guterres urged all warring parties to stop fighting and "engage constructively towards that end, including within the Berlin process".
He also warned against "external interference", which he said would "deepen the ongoing conflict and further complicate efforts to reach a clear international commitment to a peaceful resolution of the underlying crisis".
The Berlin conference will aim to agree six points including a permanent ceasefire, implementation of the arms embargo and a return to the political process for peace, Guterres said.
As well as killing hundreds of people, the fighting in Libya has also spurred a growing exodus of migrants, though nearly 1,000 intercepted at sea have been forced to return this year, according to the UN.