The conflict between Libya's Government of National Accord (GNA), recognised by the United Nations, and the eastern-based forces of Khalifa Haftar has become a cauldron for foreign rivals.
This explains how they view the war and what they are doing in Libya.
Read more: Russia and Turkey Risk an Ever-bloodier Stalemate in Libya | Explained
BACKING THE GNA
Ankara's support has propelled the GNA to recent military gains. Turkey acknowledges supplying drones, air defences and advisers. It has also brought Syrian fighters to Libya.
Turkish backing followed a 2019 deal with the GNA over their maritime border, which Ankara believes protects it against moves by Greece and Cyprus that could hem it into coastal waters.
- Russia Deploys Fighter Jets to Libya to Support Mercenaries, Says U.S. Military
- Russia and Turkey Risk an Ever-bloodier Stalemate in Libya
Turkey is also engaged in regional rivalries with LNA backers Russia in Syria, and with Egypt and the United Arab Emirates over the Muslim Brotherhood.
BACKING THE LNA
* The United Arab Emirates
Emirati policy is driven by opposition to the Muslim Brotherhood, which it sees as influential in the GNA, and to militant groups that it credits Haftar for suppressing in the east.
UN experts say the UAE supplied Haftar with drones, Russian-made air defences and armoured vehicles. The GNA accuses it of carrying out air strikes and shipping in African mercenaries.
It denies that and says it wants a ceasefire and a political solution.
The UN says Russia's Wagner company has up to 1,200 mercenaries in Libya. The U.S. military says Moscow has sent fighter jets to support them. Russian-made arms are widely used in the war.
Moscow denies sending troops or jets and calls for a political solution. Its critics believe it is involved in Libya to gain more influence in the eastern Mediterranean.
Cairo has supported Haftar since his 2014 war against militants in eastern Libya and sees him as a bulwark against Islamist groups including the Muslim Brotherhood.
It has been an important channel for arms and mercenaries according to analysts and UN experts, and security sources say air strikes have been launched from Egyptian soil.
Like the UAE, it has either denied supplying material support or not responded to UN requests for information.
President Bashar al-Assad, who relied on Russia in Syria's civil war, has officially recognised the eastern Libyan administration. Russian supplies of fighter jets and mercenaries to the LNA have flowed through Syria, according to the U.S. military.
An ally of the UAE and Egypt, Jordan has provided training to LNA fighters as well as arms, UN experts say.
European countries worry about Libya because of migration, energy supplies and Islamist militant groups. The EU recognises the GNA but there are differences between members.
Italy has sent troops to train GNA security forces. France has broadly supported Haftar while officially recognising the GNA. Greece and Cyprus object to Turkey's maritime deal with the GNA and oppose its presence in Libya.
An E.U. mission to monitor the arms embargo has deployed a French naval ship. Most seaborne supplies to Libya flow to the GNA from Turkey.
WHERE IS THE UNITED STATES?
Washington has signalled opposition to Haftar's Tripoli offensive after having sent mixed messages at times. Its military has also criticised Russian involvement.
However, President Donald Trump wants to keep out of foreign entanglements and there seems little prospect of a more active U.S. role in Libya for now.