Gibraltar's location has given it an outsized significance in the history of Europe and its fortified town, established in the Middle Ages, has hosted garrisons that sustained numerous sieges and battles over the centuries.
Excavations in the cave have shown that pottery, jewellery and Egyptian scarabs were left as offerings to the gods, probably in the hope of securing safe passage through the dangerous waters of the Strait of Gibraltar.
He says that strangers sail there by boat to make offerings to the gods and depart hot foot thinking it wrong to linger ...[19]There were more mundane reasons not to settle, as Gibraltar had many disadvantages that were to hinder later settlers.
[25] By 681 the armies of the Umayyad Caliphate had expanded from their original homeland of Arabia to conquer North Africa, the Middle East and large parts of West Asia, bringing Islam in their wake and converting local peoples to the new religion.
[26][27] Although Tariq's expedition was an outstanding success and led to the Islamic conquest of most of the Iberian peninsula, he ended his career in disgrace after falling out with the Arab general Musa bin Nusayr.
That year Ferdinand IV of Castile and James II of Aragon joined forces to attack the Muslim Emirate of Granada, targeting Almería in the east and Algeciras, across the bay from Gibraltar, in the west.
[36] The Castilians now found themselves having to besiege an entrenched enemy, but they were unable to break through the Moorish defences and, faced with a stalemate, the two sides agreed to disengage in exchange for mutual concessions and a four-year truce.
[37] Abu al-Hasan refortified Gibraltar with what the Arab chroniclers called "strong walls as a halo surrounds a crescent moon" in anticipation of renewed war, which duly broke out in 1339.
[45] Shortly after Gibraltar's recapture, King Henry IV of Castile declared it Crown property and reinstituted the special privileges his predecessor had granted during the previous period of Christian rule.
Many of the captives were subsequently released when a Spanish fleet commanded by Bernardino de Mendoza intercepted the pirate ships near Alborán as they were bringing ransomed hostages back to Gibraltar.
The Spanish crown belatedly responded to Gibraltar's vulnerability by building the Charles V Wall to control the southern flank of the Rock and commissioning the Italian engineer Giovanni Battista Calvi to strengthen other parts of the fortifications.
Although they lacked a viable landing force and took no action, Oliver Cromwell expressed interest in its capture: "if possessed and made tenable by us, would it not be both an advantage to our trade, and an annoyance to the Spaniards, and enable us [to] ... ease our own charge?
"[64] In 1693, during the Nine Years' War, in which Spain and England were allies, the remnants of an English-Dutch escort squadron under the command of Admiral Sir George Rooke took refuge at Gibraltar, pursued by the French, after losing the Battle of Lagos Bay.
The main land offensive was pursued in the Low Countries by the Duke of Marlborough, while naval forces under the command of Admiral Sir George Rooke harassed French and Spanish shipping in the Atlantic.
In 1703, Marlborough devised a plan under which his forces would launch a surprise attack against the French and their Bavarian allies in the Danube basin while Rooke carried out a diversionary naval offensive in the Mediterranean.
Casting around for an easier target, Rooke decided to attack Gibraltar for three principal reasons: it was poorly garrisoned and fortified, it would be of major strategic value to the war effort, and its capture might encourage the inhabitants of southern Spain to reject Philip.
The inhabitants and garrison of Gibraltar were promised freedom of religion and the maintenance of existing rights if they wished to stay, on condition that they swore an oath of loyalty to Charles as King of Spain.
They refused to swear allegiance to Charles III, instead professing their loyalty to Philip V.[76] They had reason to believe that their exile would not last long, as fortresses and towns changed hands frequently at the time.
Various territorial exchanges were agreed: although Philip V retained the Spanish overseas empire, he ceded the Southern Netherlands, Naples, Milan, and Sardinia to Austria; Sicily and some Milanese lands to Savoy; and Gibraltar and Menorca to Great Britain.
The effective Spanish repudiation of the treaty prompted the British initially to propose handing back Gibraltar in exchange for a peace agreement and, when that failed, to declare war on Spain.
[101] One soldier wrote despairingly in his diary: Here is nothing to do nor any news, all things being dormant and in suspense, with the harmless diversions of drinking, dancing, revelling, whoring, gaming, and other innocent debaucheries to pass the time – and really, to speak my own opinion I think and believe that Sodom and Gomorrah were not half so wicked and profane as this worthy city and garrison of Gibraltar.
The young Benjamin Disraeli described the inhabitants of Gibraltar as a mixture of "Moors with costumes as radiant as a rainbow or Eastern melodrama, Jews with gaberdines and skull-caps, Genoese, Highlanders and Spanish.
Although Gibraltar became a key coaling station where British steamships refuelled on the way to Alexandria or Cape Horn, the economic changes resulted in a prolonged depression that lasted until near the end of the century.
[139] Visiting Gibraltar in the mid-19th century, the English writer Richard Ford wrote in his Handbook for Travellers in Spain that "the differences of nations and costumes are very curious: a motley masquerade is held in this halfway house between Europe, Asia, and Africa, where every man appears in his own dress and speaks his own language.
The ultimately successful rebellion led by General Francisco Franco broke out across the Strait in Morocco, and the Spanish Republican government sought on several occasions to regain control of the Nationalist-controlled area around Algeciras.
[166] With Europe sliding towards a general war, the British Government decided to strengthen Gibraltar's defences and upgrade the naval base to accommodate the latest generation of battleships and aircraft carriers.
The Italians repeatedly carried out raids on Gibraltar's harbour using human torpedoes and divers operating from the Spanish shore, damaging a number of merchant ships and sinking one.
[189] The Gibraltarians strongly opposed this and organised a referendum in September 1967 in which 12,138 voters opted to remain with Britain with just 44 supporting union with Spain, though a further 55 voting slips were blank or invalid.
Although Britain promised to "honour the freely and democratically expressed wishes of the people of Gibraltar",[196] Prime Minister Margaret Thatcher indicated in the House of Commons that sovereignty would be on the table, in a change from the previous policy.
[202] Tourism in Gibraltar was encouraged through refurbishing and pedestrianising key areas of the city, building a new passenger terminal to welcome cruise ship visitors and opening new marinas and leisure facilities.