The platoon of some 30 marines stormed from a landing craft on to the San Felipe beach in the Spanish town of La Linea, carrying 60mm mortars and SA80 assault rifles, and took up defensive positions on the sand.

Instead of being fired on with blank rounds by fellow British soldiers pretending to be the enemy, the marines found themselves being stared at by startled local fishermen.

The enemy, when they appeared, turned out to be two blue-uniformed officers from La Linea's municipal police force, who informed the detachment of marines that they were not, as they had thought, in Gibraltar.

"They were told that they must have made a mistake. This sort of thing does not happen very often here," a police spokesman in La Linea said yesterday.

The marines beat a hasty retreat and went off to find the real Gibraltar. This, locals observed, was easily recognisable because it had a 1,398ft high rock sticking out of it.

Embarrassed Ministry of Defence officials in London admitted yesterday that the invading force, which had come from the helicopter carrier HMS Ocean, had got lost in bad weather on Sunday morning and ended up "attacking" a different country.

"It was clearly an embarrassing and unfortunate incident," an MoD spokesman said. "They made their apologies and left."

A La Linea police spokesman said: "We reported the incident to the relevant authorities at the interior ministry."

The local Europa Sur newspaper reported yesterday that Spain was considering making a formal diplomatic complaint to the British embassy in Madrid.

An embassy spokesman said yesterday that no such complaint had been received but admitted that senior diplomats on both sides had discussed the incident.

The British invasion of Spain came just as the two countries were in the middle of a delicate process of trying to sort out their 300-year-old wrangle over the Rock.

Historically it has been the Spaniards who have tried to invade Gibraltar. La Linea itself gets its name from the "firing line" for Spanish cannon. The reversal of roles has done little to ease tensions on either side of la verja, as Gibraltarians call the frontier with Spain.

HMS Ocean had reportedly stopped off in Gibraltar on its way to the Persian Gulf.

The MoD spokesman explained the marines would have guided themselves from the warship to the beach with an ordinary compass.

But he did not think disciplinary action likely: "I am sure some lessons have been learned."