The Kasbah Mosque (also: Mansouria Mosque or Mosque of Moulay al-Yazid) of Marrakech is a Friday Mosque originally built by the Almohad caliph Yaqub al-Mansour in 1185-1190 CE. It is located in the old royal kasbah of Marrakech, the city's citadel or royal district. Along with the Kutubiyya Mosque, it is one of the most important historical mosques in Marrakech.
Construction of the mosque was probably begun around 1185 and finished by 1190 (CE), at the apogee of the Almohad Empire. It was commissioned by the Almohad Caliph Yaqub al-Mansour (ruled 1184–1199) as part of the newly created imperial kasbah (citadel) district which was to be the residence of the Almohad Caliph and the seat of government. This followed with a long tradition of rulers in the Islamic world (and beyond) who built palace-cities or separate royal districts. The Kasbah Mosque was built to be the Friday Mosque (or Grand Mosque) for the caliph and for this royal district, where the ruler would go to attend prayers.
Even after al-Mansour and after the Almohad Empire had gone, the Kasbah Mosque was held in high esteem by the general population and subsequent rulers, and even competed with the Kutubiyya Mosque for prestige. As early as the Marinid era, rulers and important figures began to be buried in a cemetery just to the south of the mosque, eventually becoming the site of the Saadian dynasty's royal necropolis (referred to as the Saadian Tombs today).
In the late 16th century the mosque was severely damaged by an enormous explosion at a nearby gunpowder store. The exact date of the event is not certain, with the earliest estimation being 1562 while the latest it could have happened was in 1573-1574. In any case, the Saadi sultan Moulay Abd Allah al-Ghalib (ruled 1557-1574) undertook extensive repairs and restorations in the wake of the explosion, with the southern part of the mosque having possibly been the most damaged. The repairs and reconstruction are believed to have closely preserved the original Almohad design, although the stucco decoration visible inside the mosque today is most likely...