The first siege of Gibraltar lasted just over a month, ending on 12 September 1309. King Ferdinand IV of Castile began a campaign on 27 July 1309 against Algeciras on the opposite side of the Bay of Gibraltar, but was frustrated by the Moors of Gibraltar, who smuggled supplies to Algeciras under the cover of darkness. Ferdinand ordered Alonso Perez de Guzman to attack Gibraltar. Guzmán attacked from the north and south simultaneously. When his men reached the top of the Rock, they set up catapults and began bombarding the town with rocks. The bombardment inflicted severe damage but failed to force the Moors out and a siege ensued, which was only broken when Ferdinand offered the Moors free passage back to Africa in exchange for their surrender of Gibraltar.
The Moors surrendered Gibraltar to Castile.