Libya country profile
Libya, a mostly desert and oil-rich country with an ancient history, has more recently been known for the 42-year rule of the mercurial Col Muammar Gaddafi - and the chaos that followed his departure.
Libya was under foreign rule for centuries until it gained independence in 1951. Soon after oil was discovered and earned the country immense wealth.
Col Gaddafi seized power in 1969 and ruled for four decades until he was toppled in 2011 following an armed rebellion assisted by Western military intervention.
In recent years the country has been a key springboard for migrants heading for Europe. Concerns have also been raised over the rise of Islamist militancy there.
State of Libya
Population 6.4 million
Area 1.77 million sq km (685,524 sq miles)
Major language Arabic
Major religion Islam
Life expectancy 73 years (men), 78 years (women) (UN)
Currency Libyan dinar
The toppling of long-term leader Muammar Gaddafi in 2011 led to a power vacuum and instability, with no authority in full control.
The National Transitional Council (NTC), a rebel leadership council which had fought to oust the Gaddafi government, declared Libya ''liberated'' in October 2011 and took over the running of the country.
However, it struggled to impose order on the many armed militia that had become active in the months leading up to the ouster of Gaddafi.
In August 2012 the NTC handed power to the General National Congress (GNC), an elected parliament which went on to select an interim head of state.
Voters chose a new parliament to replace the GNC in June 2014 - the Council of Representatives (CoR), which relocated to the eastern city of Tobruk, leaving Tripoli controlled by powerful militia groups.
The Islamic State extremist militia took advantage of the conflict between forces loyal to the outgoing GNC and the new parliament to gain control of several coastal cities, including Derna and Sirte.
Late in 2015, the UN brokered an agreement to form a new "unity" government - the Presidency Council, headed by unity Prime Minister Fayez Sarraj - but both Tripoli and Tobruk administrations were reluctant to acknowledge its authority.
Mr Sarraj and some of his deputies finally arrived in Tripoli in March 2016 and set up their headquarters in a heavily-guarded naval base.
Libya's media environment is highly-polarised and virtually unregulated, reflecting the country's political instability.
Satellite TV is a key news source and many outlets are based outside Libya.
Journalism is fraught with danger; reporters face threats and attacks.
Islamic State group operates its own media from its stronghold, Sirte.
Some key dates in Libya's history:
7th century BC - Phoenicians settle in Tripolitania in western Libya, which was hitherto populated by Berbers.
4th century BC - Greeks colonise Cyrenaica in the east of the country, which they call Libya.
74 BC - Romans conquer Libya.
AD 643 - Arabs conquer Libya and spread Islam.
16th century - Libya becomes part of the Ottoman Empire, which joins the three provinces of Tripolitania, Cyrenaica and Fezzan into one regency in Tripoli.
1911-12 - Italy seizes Libya from the Ottomans. Omar al-Mukhtar begins 20-year insurgency against Italian rule.
1942 - Allies oust Italians from Libya, which is then divided between the French and the British.
1951 - Libya becomes independent under King Idris al-Sanusi.
1969 - Col Muammar Gaddafi, aged 27, deposes the king in a bloodless military coup.
1992 - UN imposes sanctions on Libya over the bombing of a PanAm airliner over the Scottish town of Lockerbie in December 1988.
2011 - Violent protests break out in Benghazi and spread to other cities. This leads to civil war, foreign intervention and eventually the ouster and killing of Gaddafi.
2016 - Following years of conflict, a new UN-backed "unity" government is installed in a naval base in Tripoli. It faces opposition from two rival governments and a host of militias.