List of sieges of Gibraltar There have been fourteen recorded sieges of Gibraltar . The modern territory of Gibraltar occupies a peninsula , long and wide , on the southern Iberian coast . Despite its size , Gibraltar ' s strategic location at the western entrance to the Mediterranean Sea and just across the eponymous Strait from Morocco in North Africa , as well as its natural defensibility , have made it one of the most fought - over places in Europe . Although there have been fourteen sieges , only five resulted in a change of rule . Seven were fought between Muslims and Catholics during Muslim rule , four between Spain and Britain from the Anglo - Dutch capture in 1704 to the end of the Great Siege in 1783 , two between rival Catholic factions , and one between rival Muslim powers . " Not the least of the curiosities of the history of Gibraltar " , according to historian George Hills , is that four of Gibraltar ' s changes in rule ( including three sieges ) took place over a matter of days or hours , " whereas great sieges which went on for months and even years changed nothing except for the thousands who died in them " . Background . The first permanent settlers on the Rock of Gibraltar were the Moors , Muslims who arrived from North Africa in the beginning of the eighth century . They used the area as a base from which to launch an invasion of the rest of the Iberian Peninsula . The Spanish " Reconquista " began later in the eighth century . The campaign eventually took 800 years to force the Moors back across the Strait , and did not reach the Bay of Gibraltar until the fourteenth century . It was not until 1309 , nearly 600 years after Gibraltar was first settled , that the first siege of Gibraltar was recorded . King Ferdinand I of Castile began a siege of Algeciras on the other side of the bay in July , but his naval blockade was unable to stop supplies being smuggled in small boats from Gibraltar to the besieged city . He sent an army under Alonso Pérez de Guzmán to take Gibraltar . De Guzmán succeeded after a month - long siege , and Gibraltar was settled by the Castilians for the first time . Six years later , the Moors attempted to retake the peninsula in the brief second siege which was abandoned at the sight of a Castilian relief force . Another Moorish attempt eventually succeeded in the third siege of February – June 1333 . A Castilian attempt to retake it in the fourth siege of June – August 1333 failed , as did the fifth siege of 1349 – 50 , in which King Alfonso XI of Castile lost his life in an outbreak of bubonic plague among the besiegers . The Moors of Granada and Fez fell out with each other over Gibraltar in 1411 , leading to the Granadans besieging the fortified town in the sixth siege and seizing it from the Marinids of Fez . Enrique Pérez de Guzmán , 2nd Count de Niebla made a failed attempt to capture Gibraltar in the seventh siege of 1436 , during which he perished . The Moorish presence in Gibraltar ended in 1462 , when Enrique ' s son Juan Alonso de Guzmán , 1st Duke of Medina Sidonia captured it after the eighth siege . What followed was a bitter dispute over the rights to the fortress . The Duke of Medina Sidonia claimed Gibraltar as his own , making a mortal enemy of Juan Ponce de León , Count of Arcos , but Henry IV of Castile declared it crown property shortly afterwards and so began a civil war . Henry was deposed in effigy in 1465 by a council of nobles who proclaimed as king his half - brother Alfonso . Gibraltar ' s ninth siege took place after Medina Sidonia persuaded Alfonso to grant him the fortress , following which the Duke sent an army to storm the town . Henry ' s governor held out for fifteen months before finally surrendering in July 1467 . Medina Sidonia ' s grandson , the third duke Juan Alfonso Pérez de Guzmán , was responsible for Gibraltar ' s tenth siege ( and , as it happened , its last for 200 years ) . Queen Isabella I again declared Gibraltar crown property in 1501 , but her death three years later left Castile in turmoil , prompting Medina Sidonia to take advantage of the kingdom ' s weakness . He assembled an army and marched on Gibraltar in the hope that the city would simply open its gates to him , but it did not , forcing him to lay siege to it instead ; he abandoned the attempt after three months . Gibraltar lived in relative peace for over 200 years after the tenth siege , by which time the " Reconquista " was completed and Spain was unified under a single crown . The Rock ' s importance as a fortress diminished and its defences were neglected . The next siege came in 1704 , during the War of the Spanish Succession . The Confederate nations ( led by England and the Dutch Republic in opposition to the unification of the Spanish and French thrones ) were seeking to gain a foothold in the Mediterranean , largely to distract the attentions of the Franco - Spanish Bourbon dynasty from a land campaign in northern Europe . Gibraltar was chosen as the target after unsuccessful attempts on other ports . The Confederates attacked on 1 August 1704 and the Spanish governor Diego de Salinas surrendered after the eleventh siege , which only lasted three days . Within a few weeks , Spanish forces began assembling to the north of Gibraltar ( now La Línea de la Concepción ) for an attempt to re - take the fortress . After the twelfth siege , which comprised a six - month bombardment and blockade from the isthmus linking Gibraltar to the mainland , the garrison was no closer to surrendering and the Franco - Spanish army abandoned the siege . The War of the Spanish Succession formally ended in 1713 with the signing of the Treaty of Utrecht , under which Gibraltar was ceded to Great Britain . It was initially assumed that Britain would not permanently retain Gibraltar , and would eventually trade it for something else , but the strength of British public opinion made it politically impossible to use the territory as a bargaining chip . Spain , meanwhile , felt betrayed by the French , who had negotiated the Treaty of Utrecht unilaterally , and was determined to regain Gibraltar . The issue came to a head in 1727 when King Philip V of Spain claimed that the British had voided of the treaty , under which Gibraltar had been ceded , due to failures to adhere to its conditions . Philip ' s forces began the thirteenth siege from the isthmus on 22 February , but after four months , the Spanish supply chain could not keep up with the demands of the siege and , lacking a navy , Spain was unable to prevent Britain from resupplying the garrison by sea . In the years following the thirteenth siege , tensions began to resurface between Britain and France , and Spain remained neutral in a series of wars waged over the two nations ' rival imperial ambitions . The Treaty of Utrecht was reaffirmed by a succession of treaties , but Spain remained determined to regain the territory she had lost . In addition to her struggles with France , Britain also struggled with her North American colonies , which culminated in the American War of Independence that began in 1776 ; three years later , Spain declared war on Britain , primarily in an attempt to win back Gibraltar . Spain broke off communications with Gibraltar in June , beginning the fourteenth and final siege — the " Great Siege of Gibraltar " — although the first shot of the siege was not fired until 12 September . Throughout the siege , the Spanish attempted to starve the garrison into submission by blockading the isthmus and bribing the Sultan of Morocco into cutting off supplies while bombarding the town and its fortifications . The Great Siege was noteworthy for the efforts of engineers on both sides to gain advantage through the adoption of novel technologies , such as the Spanish floating batteries and the British depressing carriages to allow cannon to fire downwards from the Rock of Gibraltar . However , it was fought to a stalemate and was eventually resolved through diplomatic rather than military means . Britain retained Gibraltar but ceded East and West Florida and Minorca . Gibraltar played an important role in the Napoleonic Wars in the late eighteenth and early nineteenth centuries and in many later conflicts . Hitler drew up plans to besiege Gibraltar during the Second World War ( Operation Felix ) , but the plans were never implemented and the Great Siege was the last military siege of Gibraltar . Some historians discuss the closure of the Gibraltar – Spain border ( part of an attempt by Spain to coerce the United Kingdom into ceding Gibraltar ) from 1969 to 1985 as a " fifteenth siege " ; as this differs from the other fourteen sieges in that it was not a conflict between opposing militaries , it is not included in this list .