The Almoravid dynasty () was an imperial Berber Muslim dynasty centered in the territory of present-day Morocco. It established an empire in the 11th century that stretched over the western Maghreb and Al-Andalus, starting in the 1050s and lasting until its fall to the Almohads in 1147. The Almoravid capital was Marrakesh, a city founded by the Almoravid leader Abu Bakr ibn Umar . The dynasty emerged from a coalition of the Lamtuna, Gudala, and Massufa, nomadic Berber tribes living in what is now Mauritania and the Western Sahara, traversing the territory between the Draa, the Niger, and the Senegal rivers. The Almoravids were crucial in preventing the fall of Al-Andalus (Muslim rule in Iberia) to the Iberian Christian kingdoms, when they decisively defeated a coalition of the Castilian and Aragonese armies at the Battle of Sagrajas in 1086. This enabled them to control an empire that stretched north to south. Their rulers never claimed the title of caliph and instead took on the title of Amir al-Muslimīn ("Prince of the Muslims") while formally acknowledging the overlordship of the Abbasid Caliphs in Baghdad. However, the rule of the dynasty was relatively short-lived. The Almoravids fell—at the height of their power—when they failed to stop the Masmuda-led rebellion initiated by Ibn Tumart. As a result, their last king Ishaq ibn Ali was killed in Marrakesh in April 1147 by the Almohad Caliphate, which replaced them as a ruling dynasty both in the Maghreb and Al-Andalus. Name The term "Almoravid" comes from the Arabic "al-Murabit" (), through the . The transformation of the b in "al-Murabit" to the v in almorávide is an example of betacism in Spanish. In Arabic, "al-Murabit" literally means "one who is tying" but figuratively means "one who is ready for battle at a fortress". The term is related to the notion of ribat , a North African frontier monastery-fortress, through the root r-b-t ( "rabat": to tie, to unite or "raabat": to encamp). The name "Almoravid" was tied to a school of Malikite law called "Dar al-Murabitin" founded in Sus al-Aksa, modern day Morocco, by a scholar named Waggag ibn Zallu. Ibn Zallu sent his student Abdallah ibn Yasin to preach Malikite Islam to the Sanhaja Berbers of the Adrar (present-day Mauritania). Hence, the name of the Almoravids comes from the followers of the Dar al-Murabitin, "the house of those who were bound together in the cause