LONDON/MADRID (Reuters) - Authorities in Madrid and Gibraltar gave differing versions on Monday of an incident in which a Spanish warship told commercial ships to leave anchorages near Gibraltar, the latest example of tension over the strategic port as Brexit approaches.

In toughly worded statements, Gibraltar said a Spanish warship ordered commercial ships to leave anchorages in British waters near Gibraltar, adding it was challenged by the British navy and sailed away, while the commercial ships stayed put.

The Spanish government said the commercial ships were in Spanish waters and they left the area after being contacted by the Spanish warship.

Neither side mentioned the nationality of the commercial ships.

“Anyone who believes in the rules-based international legal order will have been shocked by the cavalier and quixotic actions of the Spanish military vessel at the weekend,” Fabian Picardo, Gibraltar’s chief minister, said in a statement.

“This childish behavior is unsatisfactory whether it is errant or directed from above,” Picardo said. “The people of Gibraltar won’t be bullied now or after the 29th of March,” he added, referring to the date when Britain is set to leave the European Union.

Tensions over territorial waters often erupt between Spanish and British vessels around Gibraltar, a peninsula on the southern tip of Spain overlooking the strait between the Atlantic Ocean and Mediterranean Sea that has been ruled by Britain since 1713.

The status of Gibraltar and its 30,000 residents have been gaining attention amid the uncertainty around Britain’s exit from the EU, whether with a deal or without, with questions over free movement across its land and sea borders with Spain.

Spanish Foreign Minister Josep Borrell said a Spanish navy ship named Tornado was policing the area on Sunday in what he said was a standard procedure.

Slideshow ( 2 images )

“The Tornado called three commercial ships that were breaking maritime security law in Spanish territorial waters by standing still ...” Borrell told reporters in Brussels. “Those ships responded to the requests of the Tornado and abandoned the area,” he added.

The British government said Britain would always defend its sovereign interests in Gibraltar.

A spokesman for British Prime Minister Theresa May said there was no incursion by Spanish naval forces during the incident.

“We are certain of our sovereignty over the whole of Gibraltar, including British-Gibraltar territory waters, and any incursions are a violation of sovereignty, but not a threat to it,” the spokesman said.

Spain has already secured a right of veto over whether future Brexit arrangements can apply to Gibraltar. Prime Minister Pedro Sanchez held up an agreement on Britain’s withdrawal treaty in November over the issue and said Spain would seek joint sovereignty after Britain leaves the EU.

This also takes place as Spain gears up for an early general election on April 28.