The Almoravids, or al-Murabitun as they called themselves, were an Islamic Berber dynasty that established an empire in Morocco and eventually took it over a wide region of Northwest Africa including modern Morocco, Western Sahara, Mauritania, and part of Algeria. The emprire stretched as far south as modern Senegal and as far north as the Iberian Peninsula (modern Spain and Portugal). The Almoravids aimed to spread the Islamic traditions throughout Northern Africa and Al-Andalus which was Islamic Spain at the time.
The dynasty was initiated and first led by Yahya ibn Ibrahim from the Lamtuna tribe of the Sahara in 1040. Upon his return from a pilgrimage to Mecca with a missionary called Abdallah ibn Yasin, where he learned about the orthodox traditions of Islam (Sunnah), Yahya tried to preach that knowledge to his tribe but was opposed and forced to leave to the Saharan regions where he began to gather followers.
Yahya died in the same year and ibn Yasin was expelled from the Gudala tribe due to his extreme beliefs and punishments, but he was received more favorably in Lamtuna. Together with the help of Lamtuna chieftain Abu Bakr ibn Umar and viceroy Yusuf ibn Tashufin, they began to spread their religious ways around the Saharan desert region and took control of the entire western desert trade route. By 1062 they had conquered Morocco, Mauretania, and the Western Sahara where they established the city of Marrakech as their new capital.
In 1086 Ibn Tashufin was called on by Muslim leaders in southern Iberia to aid in repelling the Christian armies of Northern Spain. Although he was victorious in the same year over Alfonso VI, king of Leon and Castile, ibn Tashufin left to settle some troubles in Africa and returned in 1090 when the Almoravids assumed control over Muslim Spain. By the year 1094, ibn Tashufin had taken control over almost all of what is now Spain and Portugal and three years later, in 1097, he assumed the title of Amir al Muslimin which translates to commander of the Muslims. When he finally passed away in 1106, he was allegedly one hundred years old.
Although the empire had a few more victories under ibn Tashufin’s successor, Tamim Al Yusuf, including the Battle of Ucles in 1108 and the Battle of Fraga in 1134, the dynasty began to decline after its peak during ibn Tashufin’s reign. The dynasty finally came to an end in 1147 after Ali ibn Yusuf, grandson of Al Yusuf and the then-current leader, was killed while trying to escape Marrakech after a defeat in battle with the Almohads, a newly rising Berber Muslim movement.