Oil-rich Libya has been torn by violence since the 2011 toppling and killing of longtime dictator Moamer Khadafi in an uprising backed by a NATO bombing campaign. The North African country has since become a battle ground for tribal militias, jihadists and mercenaries and a major gateway for desperate migrants bound for Europe. Multiple foreign powers have sent fighters and weapons, fuelling a bloody proxy war that reflects wider geopolitical rifts and divisions in the Middle East and within NATO.Since 2015, the UN-recognised, Tripoli-based Government of National Accord (GNA) has battled against strongman Khalifa Haftar, based in the eastern city of Benghazi. Turkey’s military support for the GNA has recently tipped the balance and allowed its forces in June to repel Haftar’s 14-month advance on Tripoli and launch a counteroffensive.The frontline has since moved east to the coastal city of Sirte, Kadhafi’s home city. While the GNA under Fayez al-Sarraj has also been backed by Turkey’s Gulf ally Qatar, the renegade general Haftar has received covert support from the United Arab Emirates and Russia and backing from France.Here are the main outside players and their motivations.TURKEYUnder authoritarian President Recep Tayyip Erdogan, Turkey has projected its influence over former Ottoman territories from the Balkans to the Middle East.In Libya, Turkey has since late last year stepped up open support for the GNA with military advisors, pro-Ankara Syrian militia, drones and air defence systems, tipping the battlefield balance.Ankara and the GNA in November signed military cooperation and maritime jurisdiction agreements under which Turkey claimed extensive areas of the eastern Mediterranean where it eyes disputed oil and gas reserves.Erdogan and Russia’s President Vladimir Putin have in recent years formed a partnership, brought together by a shared distrust of the West, even as they back rival sides in the Syria and Libya wars.QATARTurkey’s gas-rich partner in the Gulf, Qatar, which hosts a key Turkish military base, has also backed the GNA.Qatar has been isolated in the Gulf since Saudi Arabia, the UAE and Bahrain along with Egypt over three years ago abruptly cut diplomatic, economic and travel ties with Doha.They insist, among other charges, that Qatar is funding radical Islamist movements, which Doha strongly denies.RUSSIAUnder Putin, Russia has expanded its global influence with military operations from Ukraine to Syria.In Libya, Haftar has received support from Russia’s Wagner Group, a shadowy private security firm reportedly close to Putin which Washington has labelled “an instrument of the Kremlin’s policy”.A UN experts’ report says Wagner has backed Haftar with “combat and influence operations”, sniper teams and technical support.The US military has accused Moscow of also supporting the mercenaries with fighter jets.Moscow has denied backing Haftar or being responsible for deploying the group.UNITED ARAB EMIRATESThe super-rich UAE has for years covertly backed Haftar forces with fighter jets, Chinese-made Wing Loong drones and other sophisticated weapons.The Emirates accuses Ankara and Doha of supporting Islamist groups, and the GNA of being close to the Muslim Brotherhood.The UAE and other Gulf countries have been said to be financing pro-Haftar fighters.The UN report also said Haftar was receiving help from pro-Damascus Syrian fighters and mercenaries from Sudan and other countries.EGYPTEgypt, worried about security along its long desert border with Libya, has long backed Haftar who is based in adjoining eastern Libya.President Abdel Fattah al-Sisi in June, after the GNA’s gains, proposed a ceasefire and then warned that Cairo could intervene militarily to halt a further eastward march by the unity government forces.Cairo-Ankara ties have deteriorated dramatically since Sisi led the army’s 2013 ouster of his predecessor, Islamist president Mohamed Morsi, who was supported by Turkey.FRANCEFrance has been suspected of favouring Haftar while insisting it is neutral in the conflict. Paris has always been eager to have influence in Libya due to its own colonial heritage in North Africa and also worries any surge in jihadist militancy there could imperil its anti-terror operations in the Sahel region to the south.