David Cameron is considering unprecedented legal action against Spain over the imposition of "politically motivated and disproportionate" border checks with Gibraltar, Downing Street said today.

The warning coincided with the departure of a British warship for the territory, played down by the British and Spanish governments as part of a long planned, routine exercise but which underscored heightened tensions over the territory.

The threat of legal action follows Madrid's decision to increase controls at the Spanish border that have led to delays of several hours for people travelling to and from the overseas territory. Spain has also raised the prospect of a €50 fee for crossing the border.

The move was greeted with disdain in Madrid, where the foreign minister said Spain would not back down on the border controls, which it regarded as a proportionate step to prevent money laundering and smuggling of tobacco and other products from Gibraltar. It follows weeks of escalating tension between the two governments after Gibraltar created an artificial reef which Spain claims has blocked its fishing vessels.

Cameron is hoping to use the European courts to ensure the Spanish government allows the free movement of people across the border with Gibraltar, the prime minister's spokesman said.

"The prime minister is disappointed by the failure of the Spanish to remove the additional border checks this weekend and we are now considering what legal action is open to us," he said.

"This would be an unprecedented step and so we would want to make [any decision] carefully.

"If we go down this route we will certainly press the EU to pursue this as a matter of urgency. They need to de-escalate this issue by the removal of border checks. We feel that these delays are politically motivated and disproportionate. That would be illegal under EU law and contrary to the right of free movement."

A European commission spokesman, Jonathan Todd, confirmed that commission officials would travel to Gibraltar in September. "They will be there to verify compliance with EU rules on frontier controls," he said.

No 10 suggested last week that David Cameron had won an assurance from Mariano Rajoy, the Spanish prime minister, that the controls would be lifted over the weekend. But Spain challenged the British version of the conversation.

Asked whether the government was considering other forms of action, the prime minister's spokesman said there were "other options" but declined to say what they were.

Motorists in Gibraltar have reported waiting up to seven hours at the border in recent weeks, with the longest queues forming at weekends.

According to reports, Spain may take its case to the United Nations, while the El País newspaper said it would seek support from Argentina, which disputes Britain's sovereignty of the Falkland Islands .

El País newspaper said that Spanish foreign minister, José García-Margallo will sound out his Argentinian counterpart, Héctor Timerman, during a meeting in Buenos Aires next month as he prepares for a "180-degree turn in policy towards the colony", the newspaper said.

Argentina has a two-year term as nonpermanent member of the UN's security council and could potentially use its position to put discussions about Gibraltar on the agenda.

The country's president, Cristina Kirchner, used a meeting of the council this week to renew demands for talks over the sovereignty of the Falklands.

Spain is also considering the possibility of raising the matter of Gibraltar at the UN's general assembly or the international court of justice at The Hague, diplomatic sources reportedly told El País.

Political tensions in the region flared after the territory began work on a concrete reef, which Spain claims will destroy local fishing. The issues to be raised at the UN could include disputed waters, Britain's failure to comply with past UN resolutions, and the disputed stretch of land which links Gibraltar and Spain, he said.

Boris Johnson entered the row on Monday, by saying the Spanish government's actions were reminiscent of the "Franco epoch" and that he hopes the UK will "prise Spanish hands off the throat of our colony".

Thousands of Royal Navy personnel set sail for a training exercise in the Mediterranean amid the diplomatic tensions. The helicopter carrier HMS Illustrious left Portsmouth naval base in Hampshire and will join the navy flagship HMS Bulwark, which has sailed from Devonport for the Cougar 13 operation.

Also sailing on Tuesday will be HMS Westminster, a type 23 frigate, which will visit Gibraltar en route.

The fleet will also include another type 23 frigate, HMS Montrose, and six Royal Fleet Auxiliary (RFA) ships.

The vessels will be taking part in what defence officials stressed was a long-scheduled deployment.