Dozens of armed factions have battled for control of oil-rich Libya since the 2011 fall of longtime dictator Muammar Gaddafi.
This week, four days of intense fighting saw pro-unity government armed forces expand their control in the capital Tripoli, where dozens of militias operate.
Further east, troops commanded by military strongman Khalifa Haftar said on Tuesday they had recaptured two important oil installations seized by a rival Islamist-led force in early March.
Haftar opposes the UN-backed Government of National Accord, instead backing a rival government based in Libya’s east.
Here is a run-down of the key militias vying for clout in Libya:
The GNA signed a ceasefire deal Thursday ending four days of clashes with rival militias, including groups allied with former prime minister Khalifa Ghweil.
Ghweil was ousted from power when the GNA took office in March 2016 and has refused to recognise the new administration.
But while Thursday’s deal has consolidated GNA control over parts of the capital, dozens of militias still operate there – including several who support Ghweil.
The GNA’s main backers in the capital include: the First Force, operating in Tripoli’s east and centre; the Deterrence Force, an Islamist group running police-like operations in the city’s east; and the Abu Slim Brigade controlling the southern working-class district of the same name.
The powerful militias of third city Misrata, east of Tripoli, also have major clout in the capital.
They played a vital role in the battle to topple Gaddafi and have been influential power-brokers in Libya ever since. They control swathes of the west including Misrata itself and districts of Tripoli.
Last year they formed the backbone of a pro-GNA coalition that ousted the Islamic State group from its coastal bastion Sirte, which they still control.
But some Misrata militias back Ghweil or Islamist militias who follow controversial Sheikh Sadek al-Ghariani, who opposes both of Libya’s rival administrations.
Troops commanded by Haftar this week ousted the Islamist Benghazi Defence Brigades from two key oil export terminals they had seized in early March.
That puts Haftar’s self-proclaimed Libyan National Army (LNA) in control of much of Libya’s east from the Oil Crescent to the Egyptian border – except for Derna, which is controlled by pro-Qaeda jihadists.
The LNA includes former Libyan army officers, militiamen, fighters from allied tribes, and some Islamist fighters.
Haftar opposes the GNA, but for two years his main priority has been battling jihadists in second city Benghazi.
An array of Islamist militias have unified ranks to fight him.
Among them are the BDB and the Revolutionary Shura Council of Benghazi, an alliance of Islamist militias that includes the al-Qaeda-linked Ansar Al-Sharia.
Southern Libya is criss-crossed by smuggling routes for people, drugs and weapons. A mosaic of tribal and ethnic forces are fighting for control of illicit trade and oil fields there.
They include Tuaregs who control the border with southern Algeria. Further east, the Tubu people operates along the borders with Chad and Sudan.
Arab tribes in the region have supported authorities in western Libya but maintain close ties with the both west and east. They regularly clash with the Tubu.