Why is Libya so lawless?
Libya has been beset by chaos since Nato-backed forces overthrew long-serving ruler Col Muammar Gaddafi in October 2011.
Western powers are now becoming increasingly concerned that so-called Islamic State (IS) has built a presence in the North African state and the US has responded by launching air strikes on the militant group.
How bad is the situation in Libya?
Only Libya's myriad armed militias really wield power - and it is felt they often hold the politicians they supposedly back to ransom.
During the uprising, anyone with a gun could command respect, and lots of armed groups emerged - up to 1,700, according to some estimates.
There are two rival parliaments and three governments - the latest government was formed in UN-brokered talks with the aim of replacing the other two. But this initiative is still on the rocks, partly because of concerns that the new government is being imposed by Western powers.
The oil-rich country once had one of the highest standards of living in Africa, with free healthcare and free education, but six years on from the uprising, it is facing a financial crisis.
This turmoil has allowed IS to gain a foothold in the country.
How much of a threat is Islamic State?
IS had taken control of an "enclave" in and around the city of Sirte, the birthplace of Gaddafi. Security experts feared this could provide a safe haven for jihadists to train, fund and plan attacks in North Africa and across the Mediterranean.
However, pro-government forces backed by the West have now pushed back the Islamists and retaken the city.
Some security analysts describe Libya as an arms bazaar. It is awash with weapons looted from Gaddafi's arsenal - making an ideal playground for jihadists fleeing air strikes in Syria and Iraq.
IS has been attacking Libyan oil facilities, has kidnapped several foreign oil workers and in 2015 was behind two high-profile attacks on Tunisia's tourism industry - carried out by gunmen trained in Libya.
Tunisia has built a partial security barrier and trench along its border with Libya aimed at preventing further atrocities.
What is the West doing?
The US has carried out at least four known air strikes in Libya since 2015. The latest one, in January, targeted an alleged training camp on the outskirts of Sirte where some IS militants had fled after the city fell.
The UK and France also have special forces operating in the North African state - the nature and extent of these operations have largely been secretive.
Three French soldiers died in July 2016 when their helicopter was shot down by militiamen who identified themselves as belonging to a new militant group called Benghazi Defence Brigades (BDB).
Last year, plans were unveiled to send 6,000 troops from a number of Nato countries, including the UK and France, to Libya to train local troops to stop IS-linked groups from gaining more territory and to provide security to diplomatic missions that were looking to move back to the capital.
However, the new unity government was reluctant to openly allow or request such a presence and the plan has still not materialised.
Former US President Barack Obama, in an interview published in April 2016, said that the "worst mistake" of his presidency was the failure to prepare for the aftermath of Col Gaddafi's overthrow.
He partly blamed then-UK Prime Minister David Cameron for "the mess", saying he had not done enough to support the North African nation whose instability was threatening its neighbours and was a factor in Europe's migrant crisis.
How did Libya end up with rival governments?
Parliamentary elections held in 2014 were disputed. Those who held power refused to give it up and remained in the capital, Tripoli.
The newly elected parliament then moved to the port of Tobruk, 1,000km (620 miles) away and set up a rival government.
This parliament still has the official backing of the UN as Libya's official legislative body - despite the fact that it is opposed to the new unity administration. It wants Gen Khalifa Haftar, who is leading the battle against Islamist militias, to keep a senior role in a future army, something the UN agreement does not guarantee.
The UN-mediated deal for a unity government has seen the formation of a nine-member Presidency Council, led by Prime Minister Fayez Sarraj. He arrived in Tripoli in March 2016 to set up his administration and has been trying to win the support of the various militias and politicians, but it has little real power over the whole country.
The council has also suffered from divisions. Two members boycotted it continuously, eventually moving to the east, while another member resigned.
Mr Sarraj, an engineer by profession, approved the 1 August 2016 US air strike on suspected IS positions in Sirte, in the first co-ordinated military action between his government and the US.
Weren't they all once allies?
They were united in their hatred for Gaddafi - but nothing more. There was no single group in charge of the rebellion. Militias were based in different cities, fighting their own battles.
They are also ideologically divided - some of them are militant or moderate Islamists, others are secessionists or monarchists and yet others are liberals. Furthermore, the militias are split along regional, ethnic and local lines, making it a combustible mix.
And after more than four decades of authoritarian rule, they had little understanding of democracy.
So they were unable to forge compromises and build a new state based on the rule of law.
Which are the main militias?
East and central:
- Gen Khalifa Haftar, an important and divisive player in Libyan politics, leads the so-called Libyan National Army (LNA), which is made up of former army units and militias loyal to them. He has cast himself as the main opponent of the Islamist militias and has the backing of the Tobruk-based government and is said to have co-ordinated military activities with Egypt and France.
- The Benghazi Revolutionary Shura Council (BRSC) is an Islamist umbrella group that includes a complex make-up of radical fighters, including those who pledged allegiance to IS. It has members of Ansar al-Sharia, the group that was blamed for the 2012 killing of US Ambassador Christopher Stevens in Benghazi. It may also be linked to the Benghazi Defence Brigades (BDB), a new group formed of Islamist fighters mainly pushed out of Benghazi. They all have found common ground in fighting against Gen Haftar.
- Islamic State's presence in Libya is now largely dispersed since the fall of its previous stronghold of Sirte. Many fighters were killed in US bombings and it is believed some left the country or headed south. IS does not control any city or town but still has a presence in various parts of the country. The group is made up of defectors from local jihadi groups and foreign fighters. Its most prominent affiliate in Libya was the Islamic Youth Shura Council (IYSC). In October 2014, the IYSC declared that Derna, a small town on the north-eastern coast and some 720km (450 miles) from Tripoli, had become the first Libyan town to join the global caliphate that IS has vowed to create. However, it was pushed out of the town by the al-Qaeda-linked Mujahideen Shura Council of Derna.
- An umbrella group known as Libya Dawn, which controlled much of the west, including Misrata and Tripoli, has split up into various brigades with differing loyalties. Some of them support the UN-backed unity government, others remain undecided. The group seized Tripoli in August 2014 with the backing of a senior Islamic cleric and was led by fighters from Misrata, the city which took pride in putting up the most fierce resistance against Col Gaddafi's forces. Some of the militias from Misrata make up a large portion of the anti-IS operation in Sirte.
What is everyday life like?
Oil production almost ground to a halt for more than two years but has recovered a little in recent months. This happened after a siege was lifted by LNA forces when they took over the main oil fields in central Libya and expelled a rival armed group led by Ibrahim Jathran. Banks are still strapped for cash, however, and there is little foreign currency available officially. The black market exchange rate has sky-rocketed in recent months, and food prices have risen. Hospitals are in short supply of medicine.
An estimated 400,000 Libyans are also internally displaced.