Libya, once shunned by much of the international community over the 1988 bombing of a PanAm plane above the Scottish town of Lockerbie, underwent a dramatic rehabilitation after taking formal responsibility for the bombing in 2003.
The UN lifted sanctions, and Libya's subsequent renunciation of weapons of mass destruction further improved relations with the West.
However, the world once again turned against the Libyan government in early 2011 over its violent response to a popular uprising inspired by anti-authoritarian protests that swept Arab countries. Several leaders urged Colonel Muammar Gaddafi to step down, and the UN Security Council passed a resolution authorising a no-fly zone over Libya and air strikes to protect civilians.
A former Roman colony, Libya is a mostly desert country which saw invasions by Vandals, Byzantines, Arabs, Turks and more recently Italians before gaining independence in 1951.
Mural celebrating 40 years of Colonal Gadaffi in power in August 2009
Politics: Colonel Gaddafi took power in a 1969 coup; he presides over a system of "people's congresses"
Economy: Libya has large reserves of oil and gas; proposed reform of state-run economy has met with political opposition
International: Libya returned to the diplomatic fold after renouncing weapons of mass destruction and paying compensation for the Lockerbie bombing
Oil was discovered in 1959 and made the state wealthy. Ten years later, King Idris was overthrown in a coup led by the 27-year-old Muammar Gaddafi, and Libya embarked on a radically new chapter in its history.
Colonel Gaddafi's revolution has been based largely on distinguishing his country from the world around it. Ideas put forward in his Green Book aim at an alternative to both communism and capitalism, while Islam is adhered to but with a unique slant - Libya has its own calendar based on the Prophet Muhammad's death, for example.
Colonel Gaddafi called the new system a jamahiriya, loosely translated as a "state of the masses". Power is held by various people's committees, while in practice Gaddafi rules unopposed.
Libya was blamed for the Lockerbie plane bombing, and two Libyans suspected of organising the incident were handed over in 1999 for trial in The Hague under Scottish law. In 2001 one of the suspects was found guilty of killing 270 people in the bombing.
After Britain and Libya signed a prisoner-exchange agreement in 2009, Libya requested the transfer of the convicted Lockerbie bomber Abdelbaset Ali al-Megrahi, who was freed from gaol on compassionate grounds and returned home in August.
Tripoli paid compensation to the US victims of the bombing in 2008, opening up the possibility of full diplomatic relations with the United States.
Libya possesses considerable reserves of oil and gas, but the sector remains relatively undeveloped.
* Full name: The Great Socialist People's Libyan Arab Jamahiriya
* Population: 6.5 million (UN, 2010)
* Capital: Tripoli
* 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)
* Monetary unit: 1 Libyan dinar (LD) = 1,000 dirhams
* Main exports: Crude oil, petroleum products, natural gas
* GNI per capita: US $12,020 (World Bank, 2009)
* Internet domain: .ly
* International dialling code: +218
Leader: Colonel Muammar Gaddafi
Once regarded as a pariah by the West, Colonel Gaddafi began his return to the international fold after Libya settled the Lockerbie bombing claims and agreed to stop developing weapons of mass destruction.
Libyan leader Muammar Gaddafi seized power in 1969
Western politicians, including the British, Italian, French and German leaders, have since visited Tripoli.
Muammar Gaddafi is the Arab world's longest-serving leader. A shrewd operator, he survived several attempts on his life and reinvented Libya's system of government.
The colonel came to power in a bloodless coup in 1969 against the ailing King Idris. He was inspired by the Egyptian nationalist leader Gamal Abdul Nasser, who dominated Arab politics in the 1950s and 1960s.
Though Col Gaddafi has always presented himself as an Arab nationalist, his attempts to forge unity with other Arab states have met with little success. In the 1990s he turned to Africa and proposed a "United States of Africa". The concept later formed the basis of the African Union.
Over the years Col Gaddafi has supported a broad range of armed groups, including the Irish Republican Army and the Palestine Liberation Organisation. Libya's alleged involvement in attacks in Europe in the 1980s triggered US military strikes in 1986. Dozens of people were killed, including the Libyan leader's adopted daughter.
One of Col Gaddafi's sons, Saif al-Islam Gaddafi, is seen as having played a large part in the rehabilitation of the Libyan regime in the eyes of the international community. However, his credibility as the "acceptable" face of the Libyan leadership was somewhat tarnished after unrest broke out in February 2011 and he became an apologist for his father.
Muammar Gaddafi was born in the desert near Sirte in 1942. He married twice and has eight children.
• In February 2011 Col Gaddafi faced a popular revolt which spread across much of the country. His opponents gained control over several towns, but he held onto Tripoli. A battle between Gaddafi loyalists and opponents sparked an exodus by foreign workers, and prompted an international debate over whether or not to intervene in the conflict.
Media rights body Reporters Without Borders has said press freedom is "virtually non-existent" in Libya, with self-censorship being commonplace.
The state strictly controls the media. Non-governmental media were authorized in 2007, leading to the launch of newspapers and a satellite TV by a company affiliated to one of Colonel Gaddafi's sons. But in 2009, these outlets were nationalized.
The Libyan Jamahiriyah Broadcasting Corporation is the state broadcaster. Pan-Arab satellite TVs are widely watched.
The main newspapers are state controlled. Some international publications are available, but the authorities routinely censor them. Few press visas are issued to foreign journalists.
There were 323,000 internet users by September 2009. Web filtering is selective, focusing on political opposition websites.
* Al-Fajr al-Jadid - controlled by an arm of the information ministry
* Al-Shams - controlled by an arm of the information ministry
* Al-Jamahiriyah - controlled by an arm of the information ministry
* Al-Zahf Al-Akhdar - controlled by the Revolutionary Committees Movement
* The Tripoli Post - English-language pro-government weekly
* Quryna - Benghazi daily
* Great Jamahiriyah TV - state-run, available terrestrially and via satellite
* Al-Libiyah - via satellite
* Great Jamahiriyah Radio - state-run
* Voice of Africa - state-run external service
* Al-Libiyah FM
* Jana (Jamahiriyah News Agency) - state-run