 In 1187 the Ayyubids under Saladin wrested control of Gaza from the Crusaders and destroyed the cathedral . The Mamluks reconstructed the mosque in the 13th @-@ century , but in 1260 , the Mongols destroyed it . It was rebuilt thereafter , but in 1294 , an earthquake caused its collapse . Extensive renovations centered on the iwan were undertaken by the governor Sunqur al @-@ Ala 'i during the sultanate of Husam ad @-@ Din <unk> between 1297 @-@ 99 . A later Mamluk governor of the city , Sanjar al @-@ Jawli , commissioned the restoration of the Great Mosque sometime between 1311 and 1319 . The Mamluks finally rebuilt the mosque completely in 1340 . In 1355 Muslim geographer Ibn Battuta noted the mosque 's former existence as " a fine Friday mosque , " but also says that al @-@ Jawli 's mosque was " well @-@ built . " Inscriptions on the mosque bear the signatures of the Mamluk sultans al @-@ Nasir Muhammad ( dated 1340 ) , Qaitbay ( dated May 1498 ) , Qansuh al @-@ <unk> ( dated 1516 ) , and the Abbasid caliph al @-@ Musta 'in Billah ( dated 1412 ) . 
