Libya's historical story is a fascinating one that traces the great ebbs and flows of North African and Mediterranean history. Down through the centuries, Libya has been blighted by its geography, lying in the path of invading empires and the wars of other nations. In more recent times the Qaddafi era brought Libya international renown and Libyans a period of both repression and relative stability. Then it all fell apart.

The Great Civilisations of Antiquity

From 700 BC, Lebdah (Leptis Magna), Oea (Tripoli) and Sabratha formed some of the links in a chain of safe Phoenician (Punic) ports stretching from the Levant around to Spain. Traces of the Phoenician presence in Libya remain at Sabratha and Leptis Magna.

On the advice of the Oracle of Delphi, in 631 BC Greek settlers established the city of Cyrene in the east of Libya. Within 200 years the Greeks had built four more cities of splendour as part of the Pentapolis (Five Cities), which included Apollonia. But with Greek influence on the wane, the last Greek ruler, Ptolemy Apion, finally bequeathed the region of Cyrenaica to Rome in 75 BC.

Meanwhile, the fall of the Punic capital at Carthage (in Tunisia) prompted Julius Caesar to formally annex Tripolitania in 46 BC. The Pax Romana saw Tripolitania and Cyrenaica become prosperous Roman provinces. Such was Libya's importance that a Libyan, Septimius Severus, became Rome's emperor (r AD 193–211).

Islamic Libya

By AD 643, Tripoli and Cyrenaica had fallen to the armies of Islam. From 800, the Abbasid-appointed emirs of the Aghlabid dynasty repaired Roman irrigation systems, restoring order and bringing a measure of prosperity to the region, while the mass migration of two tribes – the Bani Salim and Bani Hilal – from the Arabian Peninsula forever changed Libya's demographics. The Berber tribespeople were displaced from their traditional lands and the new settlers cemented the cultural and linguistic Arabisation of the region.

After centuries of rule by local and other North African Islamic dynasties, the Ottomans occupied Tripoli in 1551. The soldiers sent by the sultan to support the Ottoman pasha (governor) grew powerful and cavalry officer Ahmed Karamanli seized power in 1711. His Karamanli dynasty would last 124 years. The Ottoman Turks finally reined in their erstwhile protégés in 1835 and resumed direct control over much of Libya.

On 3 October 1911 the Italians attacked Tripoli, claiming to be liberating Libya from Ottoman rule. During almost three decades of brutal Italian rule, a quarter of Libya's population died as a result of the occupation, whether from direct military attacks, starvation or forced migration.

With the onset of WWII, devastating fighting broke out in the area around Tobruk. By January 1943, Tripoli was in British hands and by February the last German and Italian soldiers were driven from Libya.

Qaddafi's Libya

Desperately poor Libya became independent in 1951, but the country's fortunes were transformed by the discovery of oil in 1959 at Zelten in Cyrenaica. Over the decade that followed, Libya was transformed from an economic backwater into one of the world's fastest-growing economies.

On 1 September 1969, a Revolutionary Command Council, led by a little-known but charismatic 27-year-old Muammar Qaddafi, seized power in Libya. Riding on a wave of anti-imperialist anger, the new leader closed British and American military bases, expanded the armed forces and closed all newspapers, churches and political parties. Some 30,000 Italian settlers were deported.

As the colonel balanced his political theories of participation for all Libyans with the revolutionary committees that became renowned for assassinating political opponents, the US accused Libya of involvement in a string of terrorist attacks across Europe. On 15 April 1986, the US Navy fired missiles into Tripoli and Benghazi.

After Libyan agents were charged with the 1988 bombing of Pan Am flight 103 (aka the Lockerbie disaster) and the 1989 explosion of a French UTA airliner over the Sahara, UN sanctions came into effect. Finally, in early 1999, a deal was brokered and the suspects were handed over for trial by Scottish judges in The Hague. The sanctions, which had cost Libya over US$30 billion in lost revenues and production capacities, were lifted.

In December 2003 Colonel Qaddafi stunned the world by announcing that Libya would give up its nuclear, chemical and biological weapons programs and open its sites to international inspections. When asked why, Colonel Qaddafi replied that 'the program started at the very beginning of the revolution. The world was different then.' Sounding very much the international statesman, Colonel Qaddafi went on to say that 'there is never permanent animosity or permanent friendship. We all made mistakes, both sides. The most important thing is to rectify the mistakes.'

In the decade that followed, Libya (and indeed Colonel Qaddafi) regained a measure of international respectability, as world leaders once again visited Tripoli and international companies began clamouring for contracts in the country's lucrative oil and natural gas industries.

The Fall of Qaddafi & Civil War

In February 2011, at the beginning of the so-called Arab Spring and with neighbouring Tunisia and Egypt in turmoil, an anti-government demonstration in the eastern Libyan city of Benghazi, quickly spread. Most of northeastern Libya soon fell to the rebels. The rebels, backed by NATO air strikes, battled government forces loyal to the old regime, with fighting particularly heavy along the coast road and in the Jebel Nafusa in the country's northwest. The government's failure to take the cities of Misrata and Zintan in particular enabled the rebels to close in on Tripoli, which finally fell to the rebels in August 2011. Most of Libya soon fell into rebel hands, and the capture and killing of Colonel Qaddafi in October the same year marked the end of a brutal civil war in which as many as 10,000 people died.

Despite reports of score settling, the ongoing power of armed militias and the difficulties in building national, democratic institutions, the aftermath of the war in Libya has been largely peaceful. Elections for a General People's Congress in July 2012 saw liberals outnumber Islamists, although neither secured absolute majority. After several false starts, a new government was formed in November of the same year. A month later, fighting between local groups vying for power and general insecurity in the south prompted the government to close its southern borders and declare vast swathes of the country's south to be closed military zones.