 The complex contains several religious buildings including the mosque, mausoleum, madrasa and the hamam.The mosque was founded by the Marinid rulers of Morocco in 1339, and resembles Sidi al-Hulawi Mosque which was built in 1335 greatly in its shape.The madrasa was founded eight years after the mosque, where Ibn Khaldun had taught once.