The commander's abrupt departure in the early hours of Tuesday was a setback for an international diplomatic push in recent days, though Moscow insisted it would continue mediation efforts
Libyan strongman Khalifa Haftar left Moscow on Tuesday without signing a ceasefire agreement aimed at ending nine months of fighting, leaving the future of a fragile truce uncertain.
The commander's abrupt departure in the early hours of Tuesday was a setback for an international diplomatic push in recent days, though Moscow insisted it would continue mediation efforts.
Turkish President Recep Tayyip Erdogan - who first brokered the Libya truce deal with President Vladimir Putin of Russia last week - warned he would "teach a lesson" to Haftar if his forces resumed fighting.
Haftar and his allies were in Moscow on Monday for talks with the UN-recognized government headed by Fayez al-Sarraj that is based in Tripoli.
Sarraj's government has been under attack since last April from forces loyal to Haftar, who is based in the east of the oil-rich North African country with his own loyalist politicians.
The two sides had agreed to the ceasefire that took effect at the weekend and were in Moscow to sign a long-term agreement.
The talks raised hopes of an end to the latest fighting to wrack Libya since a 2011 Nato-backed uprising killed longtime dictator Moamer Kadhafi.
But after seven hours of negotiations, only Sarraj had signed on to the agreement and Russian officials confirmed to AFP that Haftar's delegation had left without inking the deal.
"We will pursue our efforts in this direction. For now, a definitive result has not been achieved," Russian Foreign Minister Sergei Lavrov said at a press conference in Sri Lanka.
Russia, European powers and Libya's neighbours "are working in the same vein and motivating all Libyan sides to agree rather than continue sorting things out by force", Lavrov said.
Russian state news agency RIA Novosti quoted a source in Haftar's stronghold Benghazi as saying he did not sign because the agreement did not spell out a timeline for disbanding groups allied with Sarraj's Government of National Accord (GNA).
Erdogan reacted angrily, saying in a televised Ankara speech: "We will not hesitate to teach a deserved lesson to the putschist Haftar if he continues his attacks on the country's legitimate administration and our brothers in Libya".
Erdogan said the issue would now be discussed at talks in Berlin on Sunday to be attended by European, North African and Middle Eastern countries as well as the UN, EU, Africa Union and Arab League.
"The putschist Haftar did not sign the ceasefire. He first said yes, but later unfortunately he left Moscow, he fled Moscow," Erdogan said.
"Despite this, we find the talks in Moscow were positive as they showed the true face of the putschist Haftar to the international community."
Western powers are keen to stabilise Libya -- home to Africa's largest proven crude reserves -- following years of turbulence since the 2011 killing of Kadhafi.
Since the start of the offensive against Tripoli, more than 280 civilians and about 2,000 fighters have been killed and 146,000 Libyans displaced, according to the United Nations.
Putin and Erdogan made a joint call for a ceasefire, which started early Sunday and was welcomed by the United Nations.
The leaders of Turkey and France on Monday called for a more permanent truce which would pave the way for a political process, while Germany was preparing its summit on Libya.
Putin late on Monday discussed the talks in Moscow with German Chancellor Angela Merkel, the Kremlin said, following her visit to the Russian capital on Saturday.
Turkey and Russia's diplomatic initiative came despite the countries being seen as supporting opposing sides.
Ankara dispatched troops -- in a training capacity, it said -- to support the GNA in January in a move criticised by European powers and US President Donald Trump.
The GNA has signed agreements with Ankara assigning Turkey rights over a vast area of the gas-rich eastern Mediterranean, in a deal denounced by France, Greece, Egypt and Cyprus.
Russia has been accused of backing pro-Haftar forces, which are also supported by the United Arab Emirates, Saudi Arabia and Egypt -- all regional rivals of Turkey.
Several hundred Russian mercenaries are reported to be in Libya supporting Haftar. Putin said any Russians in the country are not in Moscow's pay.