The mosque was built by the Fatimid vizier al-Ma’mun al-Bata’ihi, who served in this position from 1121 to 1125 under the Caliph al-Amir. He served during a period of great political and spiritual crisis for the Fatimid Caliphate, not long after the sudden incursion of the First Crusade.[1][4] He initiated a number of reforms and revived the ceremonial aspects of the caliphate, both at court and in public.[3][4] He also conducted other constructions and renovations inside the Fatimid Great Palaces.[6] He was arrested shortly after completing the mosque in 1125, and was executed 3 years later.[4]:37He had grown up in poverty following his father's death and, before being hired by the vizier al-Afdal (his predecessor), he had been working low-status jobs which reportedly included learning building skills. This early experience may have encouraged his later architectural achievements.[5]