 Caliph al @-@ Mu ’ izz li @-@ Din Allāh , the fourth Ismāʿīli Imam , conquered Egypt through his general Gawhar , wresting it from the Sunni Ikhshidid dynasty . By order of the Caliph , Gawhar then oversaw the construction of the royal enclosure of the Fatimid Caliphate and its army , and had al @-@ Azhar built as a base to spread Ismāʿīli Shi 'a Islam . Located near the densely populated Sunni city of Fustat , Cairo became the center of the Ismāʿīli sect of Shi 'a Islam , and seat of the Fatimid empire . 
