The Kasbah of the Udayas is a kasbah in Rabat, Morocco. It was built during the reign of the Almohads. When the Almohads had captured Rabat and destroyed the kasbah of the Almoravids in the town, they began reconstructing it in AH 544 / AD 1150. They added a palace and a mosque and named it al-Mahdiyya, after their ancestor al-Mahdi Ibn Tumart. After the death of Yaqub al-Mansur (AH 595 / AD 1199) the kasbah was deserted.