 The Al @-@ Hakim Mosque is named after Imam Al @-@ Hakim bi @-@ Amr Allah ( 985 – 1021 ) , the third Fatimid caliph to rule in Egypt . Construction of the mosque started in 990 . In 1002 – 3 Caliph al @-@ Hakim ordered completion of the building . The southern minaret has an inscription with his name and the date of 393 ( 1003 ) . Significant changes were made to the minarets in 1010 . At first the mosque was outside the city walls , but when Badr al @-@ Jamali rebuilt the walls he enclosed a larger area , and the north wall of the mosque became part of the new stone city wall . The mosque was badly damaged in the 1303 earthquake , and suffered further damage in later years . By the nineteenth century it was ruined , but has since been reconstructed . 
