The Almoravid (those dwelling in frontier garrisons)…
1062 CE
The Almoravid (those dwelling in frontier garrisons) confederation of Sanhaja Berber tribes—Lamtunah, Gudalah, Massufah—of the Sahara, had been inspired to improve their knowledge of Islamic doctrine by their leader Yahya ibn Ibrahim and the Moroccan theologian 'Abd Allah ibn Yasin.
From 1054, the Almoravids have merged their religious reform fervor with the conquest of Morocco and western Algeria.
Yusuf ibn Tashfin has emerged from a line of Moorish military leaders.
Abu Bakr ibn Umar, a natural leader of Lamtuna extraction, a branch of the Branès, one of the original disciples of ibn Yasin who served as a spiritual liaison for followers of the Maliki school of thought, had been appointed general after the death of his brother Yahya ibn Ibrahim.
His brother had overseen the military for ibn Yasin but had been killed in a Saharan revolt in 1056.
Ibn Yasin, too, had died in battle against the Barghawata three years later.
Abu-Bakr is an able general, taking the fertile Sūs and its capital Aghmāt a year after his brother's death, and will go on to suppress numerous revolts in the Sahara, on one such occasion entrusting his pious cousin Yusuf with the stewardship of Sūs and thus the whole of his northern provinces.
He appears to have handed him this authority in the interim but even went as far as to give Yusuf his wife, Zaynab an-Nafzawiyyat, purportedly the richest woman of Aghmāt This sort of trust and favor on part of a seasoned veteran and savvy politician reflects the general esteem in which Yusuf is held, not to mention the power he attains as a military figure in Umar’s absence.
Daunted by Yusuf's newfound power, Abu Bakr had seen any attempts at recapturing his post politically unfeasible and had returned to the fringes of the Sahara to settle the unrest of the southern frontier.
Having overrun Morocco and founded a kingdom stretching from Spain to Senegal, the Almoravids establish the city of Marrakech in the northern foothills of the High Atlas Mountains in 1062.
Yusuf assumes the title of amir al-muslimin (commander of the Muslims) but still pays homage to the 'Abbasid caliph in Baghdad.