Muslim Era
In the second half of the seventh century Muslim Arabs overran western North Africa, which they called the Maghreb (Arabic for western). The Berbers converted to Islam, but were denied many of the privileges enjoyed by the Arabs. Early in the eighth century, a number of Berbers formed a separate Muslim sect, the Kharidjites, and in 740 they revolted against Arab political and religious domination. A small autonomous Kharidjite state was founded in northern Algeria, at Tiaret, in about 776; it lasted into the 10th century.
Throughout the 9th and 10th centuries, there were Berber uprisings against the Arabs, and several autonomous Berber kingdoms were established in western Algeria. In the 11th century the Fatimid dynasty in Egypt, determined to regain Arab control over the area, sent warlike tribes into the Maghreb to destroy the power of the Berber kingdoms. As the tribes moved in, the Berbers retreated to the mountains. Here, at Tlemcen, another independent Berber dynasty arose in the 13th century, and for 200 years it ruled over much of what is now Algeria.
In the early 16th century the Spanish, who had expelled the Muslims from the Iberian Peninsula in Europe, attacked the coast of Barbary, as Europeans called the Maghreb, and won control of several ports. The Ottoman Turks, however, had begun the conquest of North Africa. Turkish corsairs (sea raiders) under the Barbarossa brothers seized the port of Algiers and in 1519 organized what is now northern Algeria into a Turkish province. Theoretically tributary to the sultan, it became increasingly independent under corsair rule. Algiers was soon one of the pirate capitals of the Barbary coast.
The Spanish attacked Algiers in 1541, but failed to take it. Gradually Spain lost its garrison posts until only those on the Gulf of Oran were left. For almost 300 years efforts by the Christian nations to curb the Barbary corsairs were largely unsuccessful.

