The modern state of Algeria is a relatively recent creation. The name was coined by the Ottoman Turks in the 16th century to describe the territory controlled by the regency of Algiers - initially a Turkish colony. The regency broke free of the Ottoman Empire (which at one stage spanned much of the Mediterranean and North Africa) and founded a military republic of unusual stability. This endured almost 300 years until spurious diplomatic problems prompted the French to invade in the 19th century.
Before the arrival of the French, Algeria was known to Europeans as the Barbary (a corruption of Berber) Coast, notorious for the pirates who preyed on Christian shipping. The dreaded Khayr al-Din, better known as Barbarossa, was the first regent of Algiers during this period, and at one point he held no fewer than 25,000 Christian captives in the city. Piracy remained a serious problem until a Barbary fleet was defeated by the US Navy off Algiers in 1815, and it was not eradicated entirely until the French attacked Algiers in 1830 and forced the ruling dey (commander or governor) to capitulate.
It took another 41 years for French domination of the country to become complete. The main opposition came from the charismatic figure of Emir Abdelkader, the great hero of Algeria's nationalist movement. Abdelkader was a sherif (descendant of the Prophet) who ruled a large slice of western and central inland Algeria. His forces resisted the French for almost six years before they were defeated near Oujda in 1844; Abdelkader himself finally surrendered in 1846 and spent the rest of his life in exile, dying in Damascus in 1883.
The French colonial authorities set about changing the face of Algeria. Local culture was actively eliminated, mosques were converted into churches and the old medinas (Arab cities) were pulled down and replaced with streets laid out in neat grids. Symbolic of the change was the conversion of the Great Mosque of Algiers to the Cathedral of St Philippe. French rule also saw large-scale appropriation of prime farming land for distribution among European settlers (known as pieds-noirs) - Italian, Maltese and Spanish as well as French.
The fighting that became Algeria's war of independence began on 31 October 1954 in Batna, east of Algiers, led by the newly formed Front de Libération Nationale (FLN; National Liberation Front). The struggle continued for seven years, with terror campaigns led by both native Algerians and pied-noir settlers; it cost at least a million Algerian lives, until French president Charles de Gaulle agreed to a referendum on independence in March 1962. The result was a resounding six million in favour and only 16,000 against.
FLN candidate Ahmed Ben Bella became Algeria's first president, promising to create a 'revolutionary Arab-Islamic state based on the principles of socialism and collective leadership at home and anti-imperialism abroad'. He was overthrown in 1965 by former backer Colonel Houari Boumédienne, effectively returning the country to military rule. Boumédienne's emphasis on industrial development at the expense of the agricultural sector was to lead in later years, to a heavy dependence on food imports and migrant workers. Boumédienne died in 1978 and the FLN replaced him with Colonel Chadli Benjedid, who was reelected in 1984 and 1989.
There was very little political change under Boumédienne and Chadli. The FLN was the sole political party, pursuing basically secular, socialist policies. There was little evidence of opposition until October 1988, when thousands of people took to the streets in protest against government austerity measures and food shortages. Between 160 and 600 people were killed. The government reacted by pledging to work towards a multiparty system. Local government elections held in early 1990 produced landslide victories for the previously outlawed fundamentalist Front Islamique du Salut (FIS; Islamic Salvation Front). The initial round of Algeria's first multiparty parliamentary elections, held in December 1991, produced another landslide for the FIS. The FLN took only 15 of the 231 seats. At this point the army stepped in. The second round of elections was cancelled, and FIS leaders Abbas were arrested while others fled into exile.
What followed was a rapid descent towards all-out civil war. Fresh elections were held in 1995; however, Islamic parties were barred from the poll, and the government's sweeping victory came amid widespread claims of fraud. Hopes for peace went unfulfilled; instead, the war became even more brutal, with Amnesty International accusing both sides of massacres and other atrocities. The GIA, angered by French aid to the government, extended the war to French soil with a series of bombings and hijackings. Eventually, government security forces began to gain the upper hand. New elections in April 1999 resulted in a controversial victory for establishment candidate Abdelaziz Bouteflika, a former foreign minister, who was elected unopposed after the rest of the field claimed fraud and withdrew.
Bouteflika quickly called a referendum on a plan to offer amnesty to the rebels. War-weary Algerians responded overwhelmingly with a 98% 'yes' vote, and by the end of 1999 many groups had responded and laid down their weapons. However, elements within the GIA remained defiant, and were suspected of assassinating FIS leader Abdelkader Hachani in October 1999 in an attempt to derail the peace process.
Since 1999 little has changed in this standoff - GIA splinter groups continue their campaign against the government, and the army continues its own campaign against the rebels, amid accusations of brutality, executions and failure to prevent massacres. Added to this has been violent unrest among the Berber people, which led to an appeasement package from the government in 2001, and criticism of media censorship.
Parliamentary elections in May 2002, won by current prime minister Ali Benflis of the FLN, were marred by violence and low voter turnout. Four parties boycotted the vote, including two of the major Berber parties. To cap all the political problems, northern Algeria was rocked by a severe earthquake in May 2003, killing more than 2000 people. In 2004's presidential elections Bouteflika was re-elected and in 2005 voters backed the government's plans for a second amnesty of those involved in the post-1992 killings.