The initial event and founder of the role of Almoravids in the history of the Maghreb occur in 1035.
Yahya ibn Ibrahim is an emir of the group of Gudala pertaining to the tribe of Sanhanja in the extreme Maghreb. He goes to the pilgrimage of Mecca. On his return, he makes halt in Kairuan and he meets a malikit Master, Abu Imran el Fasi. Yahya requires of el Fasi to indicate a student in theology to him to accompany him to the tribe of Gudala. The candidates with the voyage do not precipitate. Abu Imran then designates a man originating in the extreme Maghreb, area where is the dar el murabitun (kind of monk soldiers resulting from the extreme south from the Maghreb, with the borders of sub-Saharan Africa. It is about `Abd Allah ibn Yasim. He taught in Andalusia and tried to be essential without success in a tribe of the Atlas. Ibn Yasim is more a preacher and a leader than a scientist in theology.
The two men arrive to the tribe of Gudala and try to assert themselves by preaching. The Gudala had already several spiritual guides and ibn Yasim encounters difficulties so much so that he leaves the group to go to Lamtuna where he manages to be essential like guides spiritual. In 1058 he succeeds in federating the three groups belonging to the Berber tribe of Sanhanja: Gudala, Lamtuna and Lamta. After the death of `Abd Allah ibn Yasim, the tribe controls a territory extending from the south of the Sahara until the south of Morocco (area of Sigilmassa). The `acharit theology carried by ibn Yasim was not retained but the futures Almoravids adopted the rigorous rules of the malikit religious school. They seize the town of Aghmat and start to leave Saharan space to move towards North.
Abu Bakr becomes the second emir of Lamtuna. He melts Marrakech in 1070 and designates his cousin Yusuf ibn Tashfin to control the area in the north of the town. Abu Bakr settles in the south (Mauritania and “bilad of Sudan” or country of the Black people). In 1072, he decides to entrust to Yusuf the capacity and also his wife Zeinab, ex-wife of the chief of Sigilmassa, which has a personal fortune. In 1073, Yusuf takes the title of Emir of Believing and enjoys a broad autonomy with respect to the Abbassid caliphate. It strikes currency.
As for Abu Bakr, he launches out to the conquest of Ghana in 1076 and dies in 1087.
From 1075, Yusuf starts the conquest of Morocco starting from Marrakech. He takes Fez then Tlemcen. Ceuta falls in 1083. Shortly after, Algiers is taken. That which melts the dynasty of Almoravids controls now all the Trans-Saharan trade. He sets up an administration and divides his territory into four districts: Meekness, Fez, Sigilmassa and Tlemcen.
In Andalusia, the situation becomes perilous. Taïfas resist badly under the push of the Christian kingdoms which manage to seize Toledo in 1085. In spite of their reserves with regard to Berber, certain Andalusian kingdoms require the assistance of the Almoravids which occupy now southern bank of the strait of Tangier. They pass to Andalusia and gain a first victory over the Christians at Zallaqa, which will be worth the appreciable support of the fuqaas to them. The Almoravids start to settle durably in Andalusia and, since 1090, they seize the Taïfas. These men come from the deep south of the Maghreb are now at the head of an area which knows a cultivated and refined urban civilization. They control Cordoba, Seville and Almeria. The area of Valencia continues to resist to them. It is where the famous episode of the “El Cid”. The Almoravids manage to seize Valencia in 1102. Yusuf ibn Tashfin dies in 1106.
The two banks of the strait are placed under the same authority and space thus controlled will make remarkable cultural great strides. The Almoravids partly recover the culture of the old caliphate of Cordoba. The Hispanic-Moorish art will develop. The Almoravids make allegiance with the caliph de Baghdad while constituting a powerful Berber dynasty at the head of an autonomous State which strikes currency and animates a flourishing trade. The governors animate brilliant and refined palace life. Many mosques are built like that of Tlemcen in 1136 then that of Algiers. The history seems to be repeated. The Almoravids do not escape the critic coming from groups claiming themselves of a more rigorous religious practice and disputing the legitimacy of the capacity. The threat comes, this time, of the Almohads.