Take a look at the beta version of dw.com. We're not done yet! Your opinion can help us make it better.
Eight years since a NATO-led intervention helped oust Moammar Gadhafi, Libya is mired in civil war involving multiple armed groups and rival governments pitted against each other. DW explains the basics of the conflict.
Libya descended into chaos in the wake of the 2011 NATO-backed uprising that ousted and killed longtime dictator Moammar Gadhafi. The country has since been split between rival governments in the east and west and multiple armed groups competing for power and oil resources.
At its core, the conflict is about differences between Islamic and nationalist camps, ethnic and tribal rivalries, regional and local identities and access to oil and financial resources.
How did Libya end up with rival governments?
Contested parliamentary elections in 2014 led to the formation of two rival administrations: one in the western capital Tripoli and another in the east.
The split came after an Islamist bloc backed by armed groups refused to end the 18-month transitional mandate of the now-defunct General National Council (GNC) after they were defeated in the election.
Fighting in Tripoli between Islamist factions and forces loyal to strongman Khalifa Haftar ultimately led the newly elected House of Representatives to move the eastern city of Tobruk.
The government in the east was backed by Haftar's self-titled Libyan National Army (LNA), which has led the fight against Islamist militias.
What happened with the UN-backed government?
In 2015, the UN brokered a power-sharing deal that established a body known as the Presidency Council, led by Fayez Sarraj. The internationally recognized government was installed in Tripoli in early 2016 but it has since struggled to exert control over the country and numerous militias around Tripoli.
The Presidency Council and the government it oversees, the interim Government of National Accord (GNA), were supposed to bridge political differences between the rival administrations in the east and west.
However, the House of Representatives, which remained the internationally recognized legitimate parliament, never endorsed the Government of National Accord as envisioned by the UN-backed deal.
Instead, the parliament backed the eastern government of Abdullah al-Thinni and recognized Haftar's Libyan National Army.
The result was the formation of competing security command structures between the administrations in the east and west. The two rival administrations also established parallel central banks and competing national oil corporations.
Read more: Libyan women lose hope in the revolution
An LNA spokesman after declaring preparations were almost complete "to purge the west" of Libya "of terrorists and mercenaries."
What about oil resources?
Competition over Libya's oil and gas resources, the main source of government revenue, accounting for a large part of the economy, has been one of the main drivers of the conflict.
The struggle over oil has been exacerbated by historical grievances by people in the east, who argue that they have traditionally received fewer resources compared to the west despite producing 80 percent of the country's oil.
Since 2014, Haftar's forces have wrested control of Libya's oil crescent from mostly government-aligned militias and Islamist groups in the east where oil fields and export terminals are located. Earlier this year, his forces launched an offensive into oil-rich southern Libya and secured border crossings.
Where does the international community stand?
The civil war in Libya has been complicated by international rivalries. Egypt and the United Arab Emirates, concerned over the role of the Muslim Brotherhood in Tripoli, have backed the government in the east and provided the LNA with military support. Russia also backs Haftar.
The EU, the United States and Turkey have supported the Tripoli-based government. However, rivalries between France and Libya's former colonial ruler, Italy, have undermined a common European stance.
Although Italy and France have nominally supported the GNA, both countries have courted Haftar due to his leading role in fighting Islamist militants. France has provided Haftar with military support and intelligence regarding Islamist militants.
Rome is particularly concerned about lawlessness that has turned Libya into a springboard for migrants reaching Europe. Italy has supported the GNA and worked with militias to halt migrant flows to Europe from Libya, which have dropped dramatically over the past year.
Is a political solution in sight?
The UN has sought to hold a Libya National Conference to develop a roadmap for delayed parliamentary and presidential elections aimed at uniting the country. The UN bid follows efforts by Italy and France last year to bring together Libya's rival factions and external powers to reduce the differences between the governments in the east and west.