Back in the late Cold War, there was a lot of talking of an American strategy that imposed costs on the Russkies -- costs they couldn't afford, for things like national missile defense. It seemed pretty snazzy at the time.
It turns out that this is nothing new. Paul Kennedy, in his terrific study of The Rise and Fall of British Naval Mastery, quotes the Duke of Newcastle as stating in 1742 that, "France will outdo us at sea when they have nothing to fear on land. I have always maintained that our marine should protect our alliances on the Continent, and so, by diverting the expense of France, enable us to maintain our superiority at sea."
Kennedy says this was the key to British policy for centuries: Keep Europe in a balance of power so that no one nation dominated the continent, and all nations there would have to focus on land power at the expense of sea power. Hence Britain's "perfidious" reputation -- it didn't care much about the nature of its alliances as long as it could balance European powers while it expanded its empire outside Europe. He writes that, "of the seven Anglo-French wars which took place between 1689 and 1815, the only one which Britain lost was that in which no fighting took place in Europe." This pattern gave rise to the expression that France lost Canada in Germany.
This approach worked until 1914.
The British occupation of Gibraltar grew out of this strategy. By having a base at the mouth of the Mediterranean, the British could deter the French from moving their Mediterranean fleet out to join their Atlantic fleet.
Kennedy's book reminds me a lot of Piers Mackesy's The War for America in that it teaches not just history but strategy. I am surprised that no one told me to read it years ago.