By Peter Griffiths and Sarah White
LONDON/MADRID (Reuters) - Britain and Spain agreed on Wednesday to work together to calm tempers over the contested British overseas territory of Gibraltar, after the Spanish government threatened to restrict access to the territory.
A centuries-old conflict over the British outpost boiled over in late July when boats from Gibraltar dumped concrete blocks into the sea to make a reef, and Spain created long delays at the border days later, with lengthy car checks.
The row escalated so quickly that some believe the Spanish government is using it as a distraction from woes at home, where the ruling party has been embroiled in a corruption scandal and the economy is in a long recession.
Both sides have now said they will try to find a solution to the spat. Britain's Prime Minister David Cameron and his Spanish counterpart Mariano Rajoy talked by telephone on Wednesday.
"Mr Rajoy agreed that he did not want the issue to become an obstacle in the bilateral relations and that we needed to find a way to de-escalate the issue," Cameron's office said in a statement.
Rajoy emphasized the friendly relations between the two countries, his office said in a statement, and said the countries' foreign ministries would work together to resolve the differences.
Spain had threatened to impose harsher measures on travellers to the territory on the country's southern tip, including a 50-euro ($66.60) border-crossing fee. It also raised the prospect of tax investigations into the thousands of Gibraltarians who own property in Spain.
Madrid did not refer to extra measures on Wednesday and it was not clear whether Spain would relax its border controls.
Spaniards and Gibraltarians travelling to and from the British outpost for work or as tourists have faced queues that were sometimes several hours long.
Cameron's office said Spain had committed to reducing border measures, but later statements from Rajoy's office and the Spanish foreign ministry did not confirm that. They focused instead on Spain's right to carry out checks to crack down on smuggling and avoid tax fraud.
A LONG-RUNNING SPAT
The 1.2-km border between Spain and Gibraltar, home to close to 30,000 people, has been a frequent source of conflict with Britain in its three centuries of sovereignty over the territory.
Extensive border controls have been turned on and off before - General Francisco Franco closed the border in 1969 and it wasn't reopened until 1982, seven years after his death.
Other restrictions over British flights' access to Gibraltar from a Spanish stopover have also frequently made daily life difficult for citizens and travellers.
Until an agreement struck seven years ago with Spain's previous Socialist government, which also softened the country's stance on sovereignty discussions, Gibraltarians often had to have two mobile phones, as their international dialling code was not recognised by Spain's system.
Fishing rows and disputed waters have long been among the biggest sources of conflict.
The center-right government of Rajoy, which came to power in 2012 has taken a harder line regarding its claim on the territory.
While most Gibraltarians say they are outraged by the dramatic steps taken by Spain in the past two weeks, some said Britain also overstepped the mark.
"Although it is within our rights to protect the waters the reef is not going to replenish the seas," said retired school teacher Hector Lugaro. "There was no need for the reef."
Spain's threat of drastic border measures has raised accusations that it is milking the row to divert attention from some of the problems it has faced at home.
More than one in four Spaniards are unemployed, and the ruling People's Party (PP) are trying to defuse a scandal over illegal party financing.
Former PP treasurer Luis Barcenas - in jail pending trial on charges of bribery and tax evasion - told a judge he collected millions in cash donations from construction magnates and distributed them to senior PP figures, including Rajoy.
The premier has denied the allegations, though opposition parties are still calling for more explanations.
"Gibraltar is one of those issues that easily connects the Spanish people. Spaniards see it as a clear-cut case and there's a lot of agreement on it," said Jose Maria de Areilza, law professor at Spain's ESADE business school.
($1 = 0.7508 euros)
(Additional reporting by Dominique Searle in Gibraltar and Fiona Ortiz and Tracy Rucinski in Madrid; Editing by Stephen Addison, Andrew Osborn and Sonya Hepinstall)