It was conceived as part of a coherent religious and civic complex which included, in addition to the mosque itself, a madrasa, library, hammam (public bathhouse) with latrines, and a public fountain for distributing water to the locals.