Russia and Turkey, who have formed a sometimes rocky alliance over the past four years, back opposing sides in Libya's wrenching war but may yet find a deal over the conflict that would leave the West as bystanders, analysts say.

Such a scenario would be a replay of Russia and Turkey's alliance on Syria, where despite being on opposing sides of the conflict they have worked closely together to find a solution to the civil war, causing unease in the West.

President Vladimir Putin of Russia and Turkey's Recep Tayyip Erdogan have formed a strong partnership in just under half a decade, brought together by a shared distrust of the West, Moscow's support for Ankara in the wake of a 2016 coup bid, and economic cooperation.

Europe has been split over the conflict Europe has been split over the conflict Photo: AFP / Mahmud TURKIA

But analysts warn that Russia and Turkey are only two parties -- albeit important ones -- in the hugely complex fight for Libya which has been riven by unrest since the fall of dictator Moamer Kadhafi in 2011.

"I would not say they are kingmakers as there are other players which can disrupt any deal that they would come to bilaterally," said Emadeddin Badi, a non-resident senior fellow with the Middle East Program at the Atlantic Council, a Washington-based think tank.

"But I would say that they have the highest level of political leverage over the factions involved in the contemporary conflict. They could both spoil a political solution to the conflict if they do not perceive that it addresses their interests," he told AFP.

Libya has been riven by unrest since 2011 Libya has been riven by unrest since 2011 Photo: AFP / Mahmud TURKIA

Russia, along with the United Arab Emirates and Egypt, has backed the strongman of eastern Libya Khalifa Haftar, who has reportedly enjoyed the support of the Wagner mercenary group allegedly run by an ally of Putin.

Restoring control of Libya to the GNA would be a huge boost to Erdogan Restoring control of Libya to the GNA would be a huge boost to Erdogan Photo: AFP / Mahmud TURKIA

But Turkey, supported by its main regional ally Qatar, has backed the UN-recognised Government of National Accord (GNA) in Tripoli.

It has helped on the ground by sending in pro-Ankara Syrian militia who worked with Turkey in its Syria operations and in the air with sophisticated Turkish drones.

Europe has been split, with France despite repeated protestations of neutrality seen as preferring Haftar and former colonial power Italy the GNA, with the EU largely watching from the sidelines.

Russia and Turkey also left the West as uneasy bystanders with their cooperation from 2016 over Syria. But the alliance remains shaky and is being severely tested over the fighting in Syria's last rebel-held province of Idlib.

Some analysts say the Kremlin is changing strategy Some analysts say the Kremlin is changing strategy Photo: SPUTNIK / Alexey DRUZHININ

"I believe they can find common ground in that they could determine geographic spheres of influence (in Libya) by way of engaging with one another, both militarily and diplomatically," said Badi.

"However, a 'deal' between Moscow and Ankara would only be short-term at best -- it would not be sustainable."

The cards in Libya have been reshuffled after Haftar suffered a string of military defeats, with his forces ousted from the Tripoli region. Egyptian President Abdel Fattah al-Sisi said Haftar had accepted a ceasefire but there is scepticism over whether this will hold.

Pierre Razoux, research director at the French military's Institute for Strategic Research (IRSEM), said while there were other actors in Libya, Russia and Turkey were the players "most engaged on the side of their respective allies."

He said one possible compromise between Ankara and Moscow on Libya could encompass the Syrian conflict.

"Turkey would let Russia and the Syrian regime retake Idlib... while Russia would abandon the region of Tripoli and the gulf of Sirte to the GNA backed by Turkey," he said.

Restoring control of Libya to the GNA would be a huge boost to Erdogan, under whose rule Turkey has projected its influence over other former Ottoman territories from the Balkans to the Middle East.

"Ankara has historic ties with the Libyans, billions of dollars worth of infrastructure projects and unmistakable common interests," said Ankara-based political analyst Ali Bakeer.

In Moscow, Alexander Shumilin, director of the Europe-Middle East Center at the Russian Academy of Sciences, said the Kremlin had backed Haftar but was switching strategy in the light of his military defeats.

Putin is "faced with the choice between confronting Turkey in Libya or opposing Haftar by sacrificing him gently through calls for peace negotiations."

"Evidently, the second option is currently being favoured," he told AFP.