Turkey's Defence Minister Hulusi Akar made a surprise trip to Libya on Saturday, two days after Khalifa Haftar urged his fighters to drive out Turkish forces from the oil-rich country.
The Turkish defence ministry said Akar would inspect Turkish forces in Libya during the visit, while Libyan officials said talks would focus on military cooperation between Tripoli and Ankara.
Turkey has backed the Tripoli-based, United Nations-recognised Government of National Accord (GNA) with military advisers, material and mercenaries against an offensive last year by the eastern-based Haftar.
Ankara also has a large military base in Al Watiya region on Libya's border with Tunisia.
Akar's visit to Tripoli also came after the Turkish parliament this week adopted a motion extending the deployment of forces in Libya by 18 months.
Upon landing in the Libyan capital, Akar held talks with his counterpart Salah Eddine Namrouch and then met Khaled Al Mishri, who heads the High State Counci(HSC)l aligned with the GNA, an HSC statement said.
The Turkish and Libyan officials agreed during the talks to "pursue their coordination in a bid to repel any hostile" action by Haftar that could destabilise Libya, the statement added.
Turkish support for the GNA helped stave off the April 2019 offensive by Haftar, who is backed by Russia, Egypt and the United Arab Emirates.
During a speech on Thursday, Haftar said there would be "no peace in the presence of a coloniser on our land” and called on his forces to "get ready”.
"We will therefore take up arms again to fashion our peace with our own hands... and, since Turkey rejects peace and opts for war, prepare to drive out the occupier by faith, will and weapons,” he said.
Libya was thrown into chaos after a 2011 NATO-backed uprising toppled and led to the killing of president Muammar Qadhafi.
Wracked by violence since then, the north African country has become a battleground for tribal militias and mercenaries and a major gateway for desperate migrants bound for Europe.
Two rival camps now vie for power, with an eastern-based administration — backed by Haftar — pitted against the Tripoli-based GNA.
But in October the two sides struck a ceasefire agreement, which has been generally respected, setting the stage for elections at the end of next year.
On Saturday, the GNA’s defence minister Namrouch told local media that Libya was striving to build a military institution that respects international norms.
"The Turks have helped the GNA and we thank them for that. But now we wish to reorganise the Libyan army and inject new blood into it,” he said.
Later Saturday, Akar is expected to attend a graduation ceremony in Tripoli for military cadets who were trained in Turkey as part of the cooperation with the GNA, Libyan defence ministry sources told AFP.