Like the Bab Doukkala Mosque, it was conceived as part of a coherent religious and civic complex which included, in addition to the mosque itself, a madrasa, a library, a primary school, a hammam (public bathhouse), an ablutions house ("midha") with latrines, a water trough for animals, and a public fountain for distributing water to locals.