 In 1154 , the Arab traveler al @-@ Idrisi wrote Gaza " is today very populous and in the hands of the Crusaders . " William of Tyre confirms that in 1170 , a civilian population was persuaded to occupy the area outside the castle and establish feeble fortifications and gates surrounding the community . That same year , King Amalric I of Jerusalem withdrew Gaza 's Templars to assist him against an Egypt @-@ based Ayyubid force led by Saladin at nearby Darum . However , Saladin evaded the Crusader force and assaulted Gaza instead , destroying the town built outside the castle 's walls and killing its inhabitants after they were refused refuge in the castle , managed by Miles of Plancy at the time . Seven years later , the Templars prepared for another defense of Gaza against Saladin , but this time his forces fell on Ascalon . In 1187 , following Ascalon 's capitulation , the Templars surrendered Gaza in return for the release of their master Gerard of Ridefort . Saladin then ordered the destruction of the city 's fortifications in 1191 . A year later , after recapturing it , Richard the Lionheart apparently refortified the city , but the walls were dismantled as a result of the Treaty of Ramla agreed upon months later in 1193 . 
