On the pretext of a slight to their consul, the French invaded and captured Algiers in 1830. The conquest of Algeria by the French was long and resulted in considerable bloodshed. A combination of violence and disease epidemics caused the indigenous Algerian population to decline by nearly one-third from 1830 to 1872. Between 1825 and 1847 50,000 French people emigrated to Algeria, but the conquest was slow because of intense resistance from such people as Emir Abdelkader, Cheikh Mokrani, Cheikh Bouamama, the tribe of Ouled Sid Cheikh, whose relationships with the French vacillated from cooperation to resistance, Ahmed Bey and Fatma N'Soumer. Indeed, the conquest was not technically complete until the early 1900s when the last Tuareg were conquered.
Meanwhile, however, the French made Algeria an integral part of France. Tens of thousands of settlers from France, Spain, Italy, and Malta moved in to farm the Algerian coastal plain and occupied significant parts of Algeria's cities.
These settlers benefited from the French government's confiscation of communal land, and the application of modern agricultural techniques that increased the amount of arable land. Algeria's social fabric suffered during the occupation: literacy plummeted, while land development uprooted much of the population.
Starting from the end of the 19th century, people of European descent in Algeria (or natives like Spanish people in Oran), as well as the native Algerian Jews (typically Mizrachi and sometimes Sephardic in origin), became full French citizens. After Algeria's 1962 independence, the Europeans were called Pieds-Noirs ("black feet"). Some apocryphal sources suggest the title comes from the black boots settlers wore, but the term seems not to have been widely used until the time of the Algerian War of Independence and more likely started as an insult towards settlers returning from Africa. In contrast, the vast majority of Muslim Algerians (even veterans of the French army) received neither French citizenship nor the right to vote.
In 1954, the National Liberation Front (FLN) launched the Algerian War of Independence which was a guerrilla campaign. By the end of the war, newly elected President Charles de Gaulle, understanding that the age of empires was ending, held a plebiscite, offering Algerians three options. In a famous speech (4 June 1958 in Algiers) de Gaulle proclaimed in front of a vast crowd of Pieds-Noirs "Je vous ai compris" (I have understood you). Most Pieds-noirs then believed that de Gaulle meant that Algeria would remain French. The poll resulted in a landslide vote for complete independence from France. Over one million people, 10% of the population, then fled the country for France and in just a few months in mid-1962. These included most of the 1,025,000 Pieds-Noirs, as well as 81,000 Harkis (pro-French Algerians serving in the French Army). In the days preceding the bloody conflict, a group of Algerian Rebels opened fire on a marketplace in Oran killing numerous innocent civilians, mostly women. It is estimated that somewhere between 50,000 and 150,000 Harkis and their dependents were killed by the FLN or by lynch mobs in Algeria.
Algeria's first president was the FLN leader Ahmed Ben Bella. He was overthrown by his former ally and defence minister, Houari Boumédienne in 1965. Under Ben Bella the government had already become increasingly socialist and authoritarian, and this trend continued throughout Boumédienne's government. However, Boumédienne relied much more heavily on the army, and reduced the sole legal party to a merely symbolic role. Agriculture was collectivised, and a massive industrialization drive launched. Oil extraction facilities were nationalized. This was especially beneficial to the leadership after the 1973 oil crisis. However, the Algerian economy became increasingly dependent on oil which led to hardship when the price collapsed during the 1980s oil glut.
In foreign policy strained relations with its western neighbor Morocco. Reasons for this include Morocco's disputed claim to portions of western Algeria (which led to the Sand War in 1963), Algeria's support for the Polisario Front for its right to self-determination, and Algeria's hosting of Sahrawi refugees within its borders in the city of Tindouf.
Within Algeria, dissent was rarely tolerated, and the state's control over the media and the outlawing of political parties other than the FLN was cemented in the repressive constitution of 1976.
Boumédienne died in 1978, but the rule of his successor, Chadli Bendjedid, was little more open. The state took on a strongly bureaucratic character and corruption was widespread.
The modernization drive brought considerable demographic changes to Algeria. Village traditions underwent significant change as urbanization increased. New industries emerged and agricultural employment was substantially reduced. Education was extended nationwide, raising the literacy rate from less than 10% to over 60%. There was a dramatic increase in the fertility rate to 7–8 children per mother.
Therefore by 1980, there was a very youthful population and a housing crisis. The new generation struggled to relate to the cultural obsession with the war years and two conflicting protest movements developed: communists, including Berber identity movements; and Islamic 'intégristes'. Both groups protested against one-party rule but also clashed with each other in universities and on the streets during the 1980s. Mass protests from both camps in autumn 1988 forced Bendjedid to concede the end of one-party rule.