 Saladin , who overthrew the Fatimids in 1171 , was hostile to the Shi ’ ite principles of learning propounded at al @-@ Azhar during the Fatimid Caliphate , and under his Ayyubid dynasty the mosque suffered from neglect . Congregational prayers were banned by Sadr al @-@ Din ibn <unk> , appointed qadi by Saladin . The reason for this edict may have been Shāfi ‘ ī teachings that proscribe congregational prayers in a community to only one mosque , or mistrust of the former Shi 'a institution by the new Sunni ruler . By this time , the much larger al @-@ Hakim Mosque was completed ; congregational prayers in Cairo were held there . 
