The mosque was built in 1342 (CE) under the Marinid sultan Abu al-Hasan and was considerably restored under the Alaouite sultan Moulay Slimane (1792−1822).[1][2] Only the minaret and the mosque entrance are still essentially in their original Marinid form; the rest of the mosque generally dates from the Alaouite restoration.[3]