The Berber dynasty and empire that rose from a Saharan reform movement to rule Morocco and Muslim Spain in the late eleventh and early twelfth centuries, checking the Reconquista before falling to the Almohads.
The Almoravids — in Arabic al-Murabitun — were a Berber dynasty of the Sanhaja confederation who rose out of a religious reform movement in the western Sahara in the middle of the eleventh century and, within forty years, ruled from the Senegal river to the Ebro.
Their importance to European history is specific: they arrived in Spain in 1086 at the invitation of the taifa kings, stopped the Christian advance that had just taken Toledo, and then abolished the taifa kingdoms altogether. Muslim Spain, which had been a set of small rival states easy for Castile and Aragon to play against one another, became for fifty years a province of a North African empire.
The movement began with Abdallah ibn Yasin, a Maliki scholar brought to the Lamtuna of the western Sahara in the 1040s to teach a people whose Islam he judged inadequate. His preaching was strict and unpopular, and the name al-Murabitun probably derives from the ribat, the fortified retreat where a disciplined religious community trained — though the exact sense of the word was already debated in the Middle Ages.
Ibn Yasin supplied doctrine and the Lamtuna supplied force, first under Yahya ibn Umar and then his brother Abu Bakr ibn Umar. In 1054 and 1055 they took Sijilmasa at the northern end of the Saharan gold road and Awdaghust at its southern end, which gave the movement control of the trade in West African gold and, with it, the means to pay armies. Ibn Yasin was killed in 1059 fighting the heterodox Barghawata of the Atlantic plain.
Aghmat was taken in 1058, and about 1070 the Almoravids founded a new capital on the plain below the High Atlas at Marrakesh, a city that gave its name to the country. Abu Bakr ibn Umar then went back south to hold the desert and left his cousin Yusuf ibn Tashfin in command of the north — a temporary arrangement that became permanent, and the point at which the Almoravid state acquired a single ruler.
Yusuf spent the 1070s and 1080s conquering the rest of the Maghreb: Fez, then Tlemcen and Oujda in 1081, Algiers in 1082, and Ceuta on the strait by 1084. He never took the title of caliph, styling himself amir al-muslimin, commander of the Muslims, and acknowledging the Abbasid caliph in Baghdad — a modesty that bought him legitimacy at no cost.
When Alfonso VI of León and Castile took Toledo in 1085, the taifa kings of the south concluded that they could not survive alone. Al-Mutamid of Seville led the appeal to Yusuf, reportedly saying he would rather herd camels in Africa than herd swine in Castile. Yusuf crossed the strait and destroyed Alfonso's army at the Battle of Sagrajas in 1086.
He then drew the obvious conclusion about the men who had invited him. Backed by legal opinions from the Maliki jurists, who regarded the taifa rulers as illegitimate and their taxes as unlawful, he annexed their kingdoms one after another: Granada in September 1090, Córdoba early in 1091, Seville that September, and Almería and Murcia by the end of the year. Al-Mutamid ended his life in exile in Morocco. Valencia, held by the widow of El Cid after his death, fell in 1102, and Zaragoza was absorbed in 1110.
Yusuf died in 1106 and was succeeded by his son Ali ibn Yusuf, under whom the empire reached its greatest extent and then began to fail at both ends. Zaragoza was lost to Aragon in 1118, and an Almoravid army was beaten at Cutanda in 1120; in the west the new Portuguese county broke them at Ourique in 1139. The regime's reliance on the Maliki jurists, and its unpopularity with an Andalusi population that found its Saharan soldiers uncultivated, cost it support in Spain.
The fatal challenge came from within the Maghreb. Ibn Tumart, a Masmuda Berber preacher who declared himself the mahdi and condemned the Almoravids as anthropomorphists and bad Muslims, founded the Almohad movement in the 1120s. His successors took the Atlas, then the plains; Tashfin ibn Ali was killed near Oran in 1145, and in 1147 the Almohads stormed Marrakesh and killed the last emir, the boy Ishaq ibn Ali. An Almoravid remnant, the Banu Ghaniya, held the Balearics and fought on in North Africa for decades afterwards.