The city of Marrakesh was captured by Almohads after the death of the Almoravid leader Ali ibn Yusuf in 1147. The Almohads did not want any trace of religious monuments built by the Almoravids, their staunch enemies, as they considered them heretics. The mosque is also know as the Mosque of Booksellers, because of the street book vendors that used to be next to the Mosque.