Westminster's defence of Gibraltar is rather more than its usual commitment this week, which is usually confined to the rhetorical - and, I would argue, often little more than perfunctory.

That's because the Westminster in question is a Type 23 frigate, which happens to be arriving in Gibraltar just as relations between the territory and Spain are, to put it mildly, rocky.

The British Government insists that its appearance - just as Spanish fishing boats have been attempting to blockade the waters around the Rock, and after inflammatory statements by the Spanish prime minister, Mariano Rajoy - is coincidental, and that HMS Westminster is on its way to a longstanding routine operation at the other end of the Mediterranean. Unfortunately, that's almost certainly true.

The commitment of the landlocked Westminster in SW1 to Gibraltar, despite the rhetoric of the Spanish government, has never been anywhere near as staunch as the determination of the Gibraltarians themselves to remain British. For decades the British establishment - in particular the Foreign Office, the nest of unpatriotic vipers determined to sell the country short, as well as the lair of a few out-and-out traitors - has regarded the UK's distant territories as anachronistic.

There is a long line of - frequently well-fed - mandarins and ministers who have known, much better than the people actually living in those places, that such outposts are an embarrassment, and argued that Britain should stop pretending to be a country of much consequence, and accept its inevitable decline into obscurity.

Sir Edward Heath, who took pride in having misled the British public when he signed us up to a European superstate; Kenneth Clarke, who breezily advised Margaret Thatcher to ignore the Argentine invasion of the Falklands; and Lord Patten, who oversaw the handover of Hong Kong to the murderous Chinese dictatorship which had been publicly slaughtering its own citizens less than a decade before, are all prime examples of the breed.

Tony Blair did his best to join this roll-call when he backed Peter Hain and Jack Straw's plans to allow the British and Spanish governments to share sovereignty over Gibraltar. This carve-up was only thwarted when the Gibraltarians - "eccentrically", according to Mr Straw - decided to hold a referendum, in which 17,900 voted to remain British, while 187 (1.03%) backed shared sovereignty.

The history and geography of territorial possessions, though often cited as evidence that the place in question is an anomaly, are of very little importance when measured against the wishes of the people who actually live there.

Britain's claim on Gibraltar, as it happens, has been very strong since it was ceded to us in perpetuity under the Treaty of Utrecht in 1713 (though the Spanish waited only 14 years before trying, and failing, to win it back). Before that, it was held by loads of different people, including the Visigoths, the Moors, the King of Castile, the Duke of Medina Sidonia, and a group of Codrovan Jews who had converted to Christianity. In historical terms, the idea that Spain should "have it back" is like the French attempting to renegotiate the Louisiana Purchase, and demand the return of nearly one-third of the landmass of the United States (and a bit of Canada) - a deal which was struck 90 years after Britain acquired Gibraltar.

Similarly, geography has nothing to do with the nationality or citizenship of territories. If physical proximity is to be chief among the criteria (and in an increasingly globalised economy, that seems a strangely old-fashioned notion) there are all sorts of apparent anomalies which one could raise.

The distance between London and Gibraltar, for example, is by happy coincidence almost exactly the same as the distance between Buenos Aires and Port Stanley. The French have a départemant (Mayotte) more than 5000 miles away from Paris, which counts as an intrinsic part of France, though it is located between Madagascar and Mozambique. Croatia is divided in two by about 15 miles of Bosnia and Herzegovina, while Alaska and Hawaii are some distance from the "lower 48" of the rest of the US. The Spanish themselves have two enclaves in Morocco, Cueta and Melilla, which are just on the other side of Gibraltar.

All sorts of places have national and political allegiances which don't reflect their geographical position; Berwick swapped between England and Scotland so often that it was listed separately in treaties - though, alas, the story that it was left out of the treaty which ended the Crimean War, and thus remained officially at war with Russia until the 1980s, is a myth.

What matters are the democratic wishes of those who live in such places now. And while there are plenty of divided communities and disputed territories around the world - some of them, like the six counties of Ulster in the UK, very near to home - the people of Gibraltar and the Falkland Islands are about the least plausible candidates anywhere on earth for a reassessment of their position.

Their loyalty may be a surprise, given the traditional ambivalence of successive Westminster governments in defending their own preferences and rights to self-determination. It certainly ought to be a source of shame for those in Whitehall who would be happy to see the back of what the journalist Harry Ritchie called "The Last Pink Bits". But we shouldn't see Gibraltar and the Falkland Islands - as so many of Britain's civil servants and politicians do - as a problem, or an anomaly. The governments of Spain and Argentina don't: for them they are an opportunity.

They are, of course, perfectly well aware that there is absolutely no question about the wishes of the people who live there, nor any even vaguely plausible historical or geographical case for those territories to be handed over to their countries. It is simply that, whenever the Argentine or Spanish governments run up against economic worries, or allegations of corruption within their own ranks, a bit of sabre-rattling over those territories serves to distract the attention of their own citizens from the failings of whichever mob is currently in power.

All Senor Rajoy's implicit threats about fishing rights around Gibraltar, smuggling of duty-free goods, and his mutterings about imposing a charge on the border crossing, or closing down airspace, have, when you get right down to it, absolutely nothing to do with the Rock's status. It's just that while Gibraltar has, with its incentives to offshore businesses, very low unemployment, low corporation tax, lack of sales tax and exemption from the EU's custom's union, been thriving, Spain has been falling to pieces. But that country's prime minister would like his voters to concentrate on 2.5 square miles, and ignore the state of his country.