IT was very bad luck for David Cameron that a convoy of three Royal Navy ships - HMS Westminster and two auxiliary vessels - should be heading towards Gibraltar as part of a "routine deployment" at the very time when the Spanish cynically concocted a row over the territory's sovereignty.

The three ships put the Prime Minister in an impossible place. Call them back, to prevent the tension escalating, and he would look weak and timorous. He would have given a wonderful propaganda coup to the Spanish. Yet when the ships arrive at Gibraltar, mischief makers in Spain will be able to make an emotive case that bad old Blighty is once again behaving like an arrogant, aggressive imperial power.

That is not to justify the Spanish position, which is opportunist. The Spanish Government clearly planned the current row as a diversion, not just from the country's continuing, dismal financial plight, but also from various corruption scandals involving both the Prime Minister, Mariano Rajoy, and the Spanish royal family.

Indeed the Spanish attitude to Gibraltar is cynical, hypocritical and contradictory. Spain itself possesses controversial enclaves in Morocco - the naval base of Ceuta and the larger city of Mellila - which Morocco claims breach its territorial integrity.

Meanwhile the Spanish administration's preferred method of ratcheting up tension over Gibraltar - intensive and very prolonged searches and checks on cars crossing the narrow border between the Rock and Spain - actually inconveniences Spanish citizens far more than anyone else. Around 7500 Spaniards work in Gibraltar and return to Spain every evening. They are the ones who are being directly penalised by their own government, far more than the Gibraltarians.

But if more than 7000 Spaniards work in Gibraltar each day, does that not suggest that this supposedly self-governing territory is a bit of a nonsense? It is technically a "British dependent territory" but if so many of its labour force are Spanish citizens, it is not in reality a "Spanish dependent" territory"? If this relatively tiny piece of real estate - a huge rock, a harbour and not a great deal else - is so dependent on its big and suspicious neighbour for its labour, what is its point? It is still a symbol of British imperial pride, as some Spaniards claim? Does it have any serious use for the British state, apart from being a sentimental reminder of the days when Britain was a great international power?

The Spanish are more than entitled to point out that the people of Gibraltar are clearly anything but self-sufficient, if they require more than 7000 guest workers to keep them going each day.

There was a time, not that long ago, when it could be argued that Gibraltar had serious strategic importance. It controlled access to the Mediterranean, at its western end. Does Britain think this strategic importance still matters? Do we really want to try to control access to this huge sea, with well over a dozen very different states, with their own different and often conflicting interests, having coastlines on it? Who do we think we are? Both the strategic and the symbolic arguments lack any coherence.

Gibraltar is like the Falkland Islands: the real challenge to Britain is how to divest sovereignty with grace and diplomatic skill. Sovereignty is only meaningful if the sovereign power can credibly defend the territory, or count on steadfast allies to do so on its behalf.

Britain no longer has the capacity to defend the Falklands, and probably not the will either. That applies to Gibraltar too. International conferences could be set up to determine the future of these vestiges of the imperial era, and to protect the interests of their citizens. I understand that the people of the Falklands and the people of Gibraltar want, very fervently, to remain British, whatever that means, but I'm not sure that their wishes converge with the interests of the people of Britain.

We are dealing with the residue of empire here, and some British politicians - including Tory ones - worked out some time ago that the fewer remnants of the empire we cling onto, the better.