 In 1146, the Almohad ruler Abd al-Mu'min
 turned Rabat's ribat into a full-scale fortress to use as a launching point for attacks on Iberia.Yaqub al-Mansur (known as Moulay Yacoub in Morocco), another Almohad Caliph, moved the capital of his empire to Rabat.He built Rabat's city walls, the Kasbah of the Udayas and began construction on what would have been the world's largest mosque.