Gibraltar was seized in 1704 by the British as part of its operations against the French in the War of the Spanish Succession. The goal of the war was to prevent the French from inheriting the Spanish throne in addition to their own considerably wealthy kingdom. The British and their Dutch allies were planning to enter the Mediterranean sea in an attempt to apply pressure on the French to the South and to get the French to divert some of their naval resources from the Atlantic and the Caribbean. It was hoped that they could form a bridgehead somewhere in Southern Spain in order to advance on Madrid.
In May 1704, Admiral Rooke took 30 English ships and 19 Dutch Ships of the Line into the Mediterranean. Additionally, they carried 2,400 marines who were to be commanded by Prince George von Hesse-Darmstadt who was the Queen's cousin. They were going to attempt to seize Nice but diverted themselves to Barcelona instead. They did capture this city but were to abandon it shortly afterwards. They then heard the disturbing news that the French Brest Fleet had entered the Mediterranean seeking to rendezvous with the Toulon fleet which would have created un unassailable combined strength of some 95 ships of the line. The British and Dutch fleet needed to find a safe anchorage West of Toulon in order to plan their next move. They considered trying to take Cadiz but assumed that it would be very heavily defended. The Prince then suggested Gibraltar - it would be garrisoned but not to the extent that Cadiz would be.
On August 1st, the fleet entered Gibraltar Bay. Boatloads of Marines were despatched to the Isthmus to close off the Peninsular. The Spanish Governor was asked if he would surrender in face of the overwhelming firepower at the British and Dutch command. The Spanish governor refused as a point of honour.
A thunderous bombardment commenced on August 3rd against the Spanish garrison. The overwhelming gunfire was quickly followed up by the marines who swarmed into the devastated Spanish batteries and defences. It was all over by nightfall. The Spanish requested a three day grace period to tend to the sick and wounded. On August 6th the Prince claimed the port - but not for England - but for the Austrian Charles of Habsburg who was the candidate the English were backing for the Spanish throne.
In the aftermath of the battle, the Protestant British and Dutch treated the local Catholic population brutally and harshly. Churches were ransacked, property was looted and women were raped as officers lost control of their troops. Utterly traumatised by these events, the population fled into exile, many of them setting up a new version of the town in nearby San Rocque. Indeed, San Rocque still has the ecclesiastical and civic records from the original Spanish settlement in Gibraltar.
The seizure of Gibraltar allowed the English and Dutch fleet to meet the French off of Malaga on August 24th. After a hard fought battle in which the English virtually ran out of ammunition, the two fleets broke off from one another. Although technically a draw, the result went hand in hand with the land victory at Blenheim on the very same day. These combined results were a serious setback for the French backed candidate. The war would drag on for another 8 years before the Treaty of Utrecht in 1713 would finally close the conflict. It was to be this Treaty that would formally cede Gibraltar (along with Minorca) to the British in perpetuity. This would give the British a permanent base in the Mediterranean for the first time.