Madrid (AFP) - Spain said Friday it was closer to asserting control over Gibraltar after Britain voted to leave the European Union, prompting London to jump to the defence of its overseas territory.

The tiny rocky outcrop on Spain's southern tip has long been the subject of an acrimonious sovereignty row between London and Madrid, which wants Gibraltar back after it was ceded to Britain in 1713.

"Our formula... is British-Spanish co-sovereignty for a determined period of time, which after that time has elapsed, will head towards the restitution of Gibraltar to Spanish sovereignty," Spain's acting Foreign Minister Jose Manuel Garcia-Margallo told Spanish radio.

"The Spanish flag is much closer to the Rock."

But Britain's Minister for Europe David Lidington sought to ease concerns in the 33,000-strong territory, which awoke to news of Brexit with quiet shock.

"I want to be absolutely clear. The United Kingdom will continue to stand beside Gibraltar," he said in a statement.

"We will never enter into arrangements under which the people of Gibraltar would pass under the sovereignty of another state against your wishes."

- 'Will never be Spanish' -

In a speech to Gibraltar's parliament, Chief Minister Fabian Picardo scorned Margallo's comments.

"Let others make irrelevant noises about flying flags over our Rock if they want to waste their breath," he said.

"Such ideas will never prosper.... Gibraltar will never be Spanish in whole, in part or at all."

Spain's conservative government, which has been in place since 2011 and is expected to win elections Sunday -- albeit without an absolute majority -- has been particularly vocal about its desire to see Gibraltar come back into its fold.

The Rock is now worried that it will be at the mercy of Madrid without the protection of the EU, which has had to intervene in the past to ease rows between the two, particularly over the flashpoint border crossing.

It is also concerned about its flourishing economy, which depends in large part on its access to the EU's single market.

Story continues

Margallo said the issue of Gibraltar was no longer within the remit of the European Union, after Britons voted to leave the bloc in Thursday's referendum.

"It is now a bilateral issue that will be negotiated exclusively between the United Kingdom and Spain," he said.

The idea of joint-sovereignty is not new, and such a proposal was etched out between Britain and Spain in 2001 and 2002. But it was binned after Gibraltarians rejected it in a November 2002 referendum.

Gibraltarians also turned out en masse to vote in the EU referendum, and 96 percent of those who cast their ballot chose to remain in the European Union.

Alfredo Vasquez of the Gibraltar Federation of Small Businesses said people in the Rock were still trying to digest the news.

"There is a bit of shock. We knew it was going to be close but generally the indications seemed to point towards a Remain result. It's a little bit surprising."

- Spanish workers in fear -

They were not the only ones to wake up in shock.

Spanish workers on the other side of the border, many of whom depend on jobs in Gibraltar for their livelihood, reacted with "a lot of concern and fear."

The border town of La Linea de la Concepcion is of particular concern.

Unemployment in this 72,000-strong city stands at 40 percent, one of the worst-hit places in Spain, and the majority of those who work do so over the border.

Juan Jose Uceda of the Association of Spanish Workers in Gibraltar said the grouping feared that the "work situation for thousands of Spaniards and foreigners working in Gibraltar will become more difficult."

They fear that the crucial land border crossing to Gibraltar could be affected as it has been in the past.

In one particularly belligerent row over disputed waters, Spanish authorities upped border checks in 2013, creating hours-long logjams and forcing the European Commission to wade in and ease the crisis.

But Spain's acting Prime Minister Mariano Rajoy sought to ease concerns in a televised address.

"With regards to Spanish citizens working in Gibraltar... their rights have not changed," he said.