Turkey on Saturday said Khalifa Haftar's forces in Libya need to withdraw from the strategic city of Sirte for a ceasefire agreement to be reached and accused France of "jeopardising" NATO security by backing him.

Ankara's support for the UN-recognised Government of National Accord (GNA) in Tripoli has turned the tide in the conflict in Libya which has been mired in fighting between rival groups since a 2011 uprising toppled longtime dictator Moamer Kadhafi.

Haftar, a former Kadhafi army commander who is supported by Egypt and the United Arab Emirates, has been battling to take the capital Tripoli since last year.

Ibrahim Kalin, the Turkish presidential spokesman, said that Turkey supports the GNA position that Sirte and Al-Jufra should be evacuated by Haftar's LNA forces for a "sustainable ceasefire."

"It should be a sustainable ceasefire, meaning that the other side, the LNA (Libyan National Army), should not be in a position to launch another attack on the legitimate Libyan government any time it wants," Kalin told AFP in an interview in Istanbul.

Haftar's Libyan National Army (LNA) had been battling to take the capital since last year
Haftar's Libyan National Army (LNA) had been battling to take the capital since last year AFP / Abdullah DOMA

Kalin said a ceasefire in Libya would be possible if everybody went back to their positions in 2015, referring to a political agreement reached that year in Morocco. That would mean Haftar withdrawing from Sirte and Al-Jufra.

"This is the position of the GNA and we support it because right now the Haftar forces are using these strategic locations as their launching pad," he said.

Turkish-backed GNA forces, which regained control of the whole of northwest Libya early this month, remain hampered in their advance toward Sirte, a coastal city and a gateway to major oil fields in the east.

The hometown of Kadhafi, Sirte, located 450 kilometres (280 miles) east of Tripoli, was a stronghold of the Islamic State (IS) group, before being taken over in 2016 by the GNA. It fell last January into the hands of Haftar's camp.

Turkey has forged strong ties with GNA head Fayez al-Sarraj, sending drones and air defence systems that helped him repel Haftar's recent offensive.

Turkey's Presidential Spokesperson İbrahim Kalın, seen here last year, says Haftar's forces need to pull back from Sirte
Turkey's Presidential Spokesperson İbrahim Kalın, seen here last year, says Haftar's forces need to pull back from Sirte AFP / Yasin AKGUL

A high-level Turkish delegation including Kalin, the foreign minister and intelligence chief visited Tripoli on Wednesday.

Kalin also accused France of "jeopardising" NATO's security by supporting Haftar.

"In Libya we are supporting the legitimate government and the French government is supporting an illegitimate warlord and jeopardising NATO security, Mediterranean security, North African security and Libya's political stability," Kalin said.

Map showing the positions of forces fighting in Libya, as of June 3
Map showing the positions of forces fighting in Libya, as of June 3 AFP / Thomas SAINT-CRICQ

"Given all this they still blame us, they still criticise us ... We are working with the legitimate actors here. It is France that is intervening in all of those areas, working with the wrong actors, supporting illegitimate players and then turning and accusing us."

Tensions have increased between Turkey and France, which has long been suspected of favouring Haftar until his recent battlefield setbacks.

NATO has launched an official investigation into a naval incident in the Mediterranean between the alliance members after France denounced an "extremely aggressive" act by Turkish frigates against a French navy vessel.

Paris has complained that one of its ships was subjected to radar targeting by Turkish frigates while trying to inspect a cargo vessel believed to be carrying arms to Libya.

But Ankara dismissed the allegations as "groundless".

"France for us is an important NATO ally. It is an important country in Europe. We don't want to have any tensions with France or any other country," Kalin said.

Eastern based Haftar -- a 76-year-old former Kadhafi loyalist turned defector who spent years living in the United States -- has been backed by powers including Russia, the UAE and Egypt with aircraft, weapons and mercenaries.

Turkey sees no role for Haftar in Libya's future.

"He has been unreliable from the very beginning. He has spoiled every single ceasefire agreement, every attempt at de-escalation and the GNA will not support any talks that will involve Haftar. This is what we are gathering from their analysis and we support that," Kalin said.

Kalin accused the UAE of "financing this war" in Libya and called "foolish" its attempts to attack Turkey and President Recep Tayyip Erdogan for their role in the Arab-Muslim world.

On Egypt, Kalin said Ankara understands Cairo's "legitimate" security concerns over the Egyptian-Libyan border but supporting Haftar is a "wrong policy".

"They should support the GNA, they should support a Libyan-led political process."

Asked about Turkey's future in Libya, Kalin said: "We will be there as long as we are requested by the Libyan government to be there."