During the second half of the 19th Century the British designated four of their key ports with dockyards as being Fortresses. The location of these well defended harbours reflects the Eurocentric nature of British strategic concerns at that time, largely concentrated around the North Atlantic and Mediterranean Seas. The Fortresses, including Gibraltar, were Malta, Bermuda and Halifax.
After coming under the control of various parties, in 1704 an Anglo/Dutch force captured the peninsular as part of the Grand Alliance in the War of the Spanish Succession (1701-1704). In 1713 as part of the Treaty of Utrecht control of Gibraltar was ceded to Britain. The Rock faced numerous sieges for the rest of the 18th Century, including the Great Siege of 1779 to 1783.
During the Napoleonic Wars, Gibraltar became a key location for the Royal Navy and played an important role in the run up to the Battle of Trafalgar in 1805. Lord Nelson’s body was brought back to Rosia Bay after this decisive battle.
The Rock Played an equally important role during the Crimean War (1854-1856) as a transit hub.
With the opening of the Suez Canal in 1869, Gibraltar increased in importance as a transit port for ships travelling to India and the Far East through the Suez Canal.
During World War 2 Gibraltar was heavily fortified with miles of tunnels built and new fortifications.
The HM Dockyard at Gibraltar was built 1893 to 1903 with three dry docks. It remained operation until 1984. See https://www.gibdock.com/history/
During the 18th Century, Gibraltar was continually attacked by various continental forces, primarily from Spain and France. The fortifications were therefore in a constant state of evolution. The table below gives a summary of the batteries built in Gibraltar by the British between 1713 and 1957.
Roughly based on work prepared by Brigadier H.G. Wainwright D.S.O on his departure from Gibraltar in 1954. Document held in the Garrison Library in Gibraltar (https://www.ggl.gi/).