(Updates in second to fifth paragraphs with Haftar's demands)

Turkish President Recep Tayyip Erdoğan threatened General Khalifa Haftar, the leader of the Libyan National Army (LNA), with military action after ceasefire talks to stop fighting in the country ended inconclusively.

Haftar will pay a heavy price should he renew his push to topple the government in Tripoli, Erdoğan said in a speech in Ankara on Tuesday. Erdoğan spoke after the LNA leader left indirect peace talks in Moscow on Monday without signing a deal.

The general has rejected Turkey's role as a mediator in the conflict and demanded the formation of a U.N. committee to oversee the breakup of militias that support the Tripoli government, pan-Arab daily Asharq al-Awsat said.

Haftar said on Monday evening that he would consider the terms of the ceasefire until the next morning, but returned from Russia on Tuesday without signing it.

Instead, the general is sticking by demands that would see the Syrian rebel allies Turkey deployed in Libya sent home, also stipulating that Turkey does not participate in international monitoring of the peace process, German state broadcaster Deutsche Welle reported.

"We will never refrain from giving the putschist Haftar a deserved lesson should he continue attacks on the country's legitimate government and our brothers in Libya," Erdoğan said on Tuesday. "The Tripoli government was very constructive and conciliatory during the talks. But the putschist Haftar refused to sign the truce. He waited, then left Moscow, he fled."

Libya's warring parties were negotiating over the terms of ending nine months of fighting. Libya is split between the United Nations-recognised Government of National Accord (GNA) in Tripoli, and the Tobruk government, backed by Haftar, who has taken over key cities since launching his offensive to capture Tripoli. Turkey backs the Islamist GNA with troops, advisers and militants transferred from Syria, while Moscow supports Haftar’s LNA.

Erdoğan and Russian President Vladimir Putin last week called on all fighting parties in the Libyan conflict to accept a ceasefire beginning on Jan. 12 as a way to open the peace talks. That message was repeated by the two leaders' foreign ministers in Moscow on Monday. Turkey is the main backer of the GNA in Tripoli, while Haftar is also supported by Egypt, the UAE and France, Russian mercenaries are present alongside LNA forces.

The ceasefire appears to have largely held despite the continuation of some fighting. GNA leader Fayez al-Sarraj signed the agreement in Moscow, but Haftar left without penning the deal and asked for until Tuesday to consider it.

Germany is planning to host United Nations-led peace talks for Libya in Berlin later this month. Turkey and Russia are also due to attend.