Two Libyans suspected of bringing down Pan Am Flight 103 in 1988 are handed over for eventual trial in the Netherlands.

Pan Am Flight 103 was a regularly scheduled Pan Am transatlantic flight from Frankfurt to Detroit via a stopover in London and another in New York City. The transatlantic leg of the route was operated by Clipper Maid of the Seas, a Boeing 747-121 registered N739PA. Shortly after 19:00 on 21 December 1988, while the aircraft was in flight over the Scottish town of Lockerbie, it was destroyed by a bomb that had been planted on board, killing all 243 passengers and 16 crew in what became known as the Lockerbie bombing. Large sections of the aircraft crashed in a residential street in Lockerbie, killing 11 residents. With a total of 270 fatalities, it is the deadliest terrorist attack in the history of the United Kingdom.Following a three-year joint investigation by Dumfries and Galloway Constabulary and the US Federal Bureau of Investigation (FBI), arrest warrants were issued for two Libyan nationals in November 1991. In 1999, Libyan leader Muammar Gaddafi handed over the two men for trial at Camp Zeist, the Netherlands, after protracted negotiations and UN sanctions. In 2001, Abdelbaset al-Megrahi, a Libyan intelligence officer, was jailed for life after being found guilty of 270 counts of murder in connection with the bombing. In August 2009, he was released by the Scottish government on compassionate grounds after being diagnosed with prostate cancer. He died in May 2012 as the only person to be convicted for the attack.

In 2003, Gaddafi accepted responsibility for the Lockerbie bombing and paid compensation to the families of the victims, although he maintained that he had never given the order for the attack. Acceptance of responsibility was part of a series of requirements laid out by a UN resolution for sanctions against Libya to be lifted. Libya said it had to accept responsibility due to Megrahi's status as a government employee.During the First Libyan Civil War in 2011, former Minister of Justice Mustafa Abdul Jalil claimed that the Libyan leader had personally ordered the bombing, though this was later denied, while investigators have long believed that Megrahi did not act alone, and have been reported as questioning retired Stasi agents about a possible role in the attack.

Some relatives of the dead, including Lockerbie campaigner Jim Swire, believe the bomb was planted at Heathrow Airport, and not sent via feeder flights from Malta, as the US and UK claim. A sleeper cell belonging to the Popular Front for the Liberation of Palestine (General Command) had been operating in West Germany in the months before the Pan Am bombing.On the 32nd anniversary of the bombing, 21 December 2020, Abu Agila Mohammad Masud was charged in the US for having built the bomb that destroyed the aircraft and acting as a co-conspirator.

Muammar Gaddafi became the de facto leader of Libya on 1 September 1969 after leading a group of young Libyan Army officers against King Idris I in a bloodless coup d'état. After the king had fled the country, the Revolutionary Command Council (RCC) headed by Gaddafi abolished the monarchy and the old constitution and established the Libyan Arab Republic, with the motto "freedom, socialism and unity".After coming to power, the RCC government initiated a process of directing funds toward providing education, health care and housing for all. Public education in the country became free and primary education compulsory for both sexes. Medical care became available to the public at no cost, but providing housing for all was a task the RCC government was unable to complete. Under Gaddafi, per capita income in the country rose to more than US$24,000, the highest in Africa. The increase in prosperity was accompanied by a controversial foreign policy, and there was increased domestic political repression.During the 1980s and 1990s, Gaddafi, in alliance with the Eastern Bloc and Fidel Castro's Cuba, openly supported rebel movements like Nelson Mandela's African National Congress, Yasser Arafat's Palestine Liberation Organization, the Provisional Irish Republican Army and the Polisario Front (Western Sahara). Gaddafi's government was either known to be or suspected of participating in or aiding attacks by these and other proxy forces. Additionally, Gaddafi undertook several invasions of neighboring states in Africa, notably Chad in the 1970s and 1980s. All of his actions led to a deterioration of Libya's foreign relations with several countries, mostly Western states, and culminated in the 1986 United States bombing of Libya. Gaddafi defended his government's actions by citing the need to support anti-imperialist and anti-colonial movements around the world. Notably, Gaddafi supported anti-Zionist, pan-Arab, pan-Africanist and Arab and black civil rights movements. Gaddafi's behavior, often erratic, led some outsiders to conclude that he was not mentally sound, a claim disputed by the Libyan authorities and other observers close to Gaddafi. Despite receiving extensive aid and technical assistance from the Soviet Union and its allies, Gaddafi retained close ties to pro-American governments in Western Europe, largely by courting Western oil companies with promises of access to lucrative Libyan energy sectors. After the 9/11 attacks, strained relations between Libya and the West were mostly normalised, and sanctions against the country relaxed, in exchange for nuclear disarmament.

In early 2011, a civil war broke out in the context of the wider "Arab Spring". The rebel anti-Gaddafi forces formed a committee named the National Transitional Council on 27 February 2011. It was meant to act as an interim authority in the rebel-controlled areas. After killings by government forces in addition to those by the rebel forces, a multinational coalition led by NATO forces intervened on 21 March 2011 in support of the rebels. The International Criminal Court issued an arrest warrant against Gaddafi and his entourage on 27 June 2011. Gaddafi's government was overthrown in the wake of the fall of Tripoli to the rebel forces on 20 August 2011, although pockets of resistance held by forces in support of Gaddafi's government held out for another two months, especially in Gaddafi's hometown of Sirte, which he declared the new capital of Libya on 1 September 2011. The fall of the last remaining sites in Sirte under pro-Gaddafi control on 20 October 2011, followed by the subsequent killing of Gaddafi, marked the end of the Libyan Arab Jamahiriya.

The name of Libya was changed several times during Gaddafi's tenure as leader. From 1969 to 1977, the name was the Libyan Arab Republic. In 1977, the name was changed to Socialist People's Libyan Arab Jamahiriya. Jamahiriya was a term coined by Gaddafi, usually translated as "state of the masses". The country was renamed again in 1986 as the Great Socialist People's Libyan Arab Jamahiriya, after the 1986 United States bombing of Libya.