MADRID (Reuters) - The European Union could agree to extend the deadline for Brexit, but not beyond elections for the EU parliament due in May, Spain’s foreign minister said on Monday.

FILE PHOTO: Spanish Foreign Minister Josep Borrell waits for Russian Foreign Minister Sergei Lavrov before a meeting at the foreign ministry in Madrid, Spain, November 6, 2018. REUTERS/Sergio Perez

Britain’s exit from the EU on March 29 is uncertain as parliament is likely to vote on Tuesday against its agreed exit deal, opening up outcomes ranging from a disorderly divorce to reversing Brexit altogether.

“A hard Brexit would be a catastrophe for everyone,” Foreign Minister Josep Borrell said during a conference in Madrid.

“It is possible that the timeframe may be extended,” Borrell said without giving details about how this might happen. “The real deadline is the European election, because it has been planned without British representation.”

Britain is now due to leave the EU on March 29. The deadline can be extended if Britain requests this and the other 27 EU members agree. The EU’s top court has also ruled that Britain has the power to cancel Brexit altogether before it leaves.

Speculation that Britain may try to delay its departure has been creating legal headaches in Brussels.

Even in the case of Britain leaving the union without a deal, bilateral agreements with Spain would remain in place over Gibraltar, Borrell said. Gibraltar is a British territory on Spain’s southern coast and relies on a free flow of labor and trade from the Spain. Spain has long claimed sovereignty of Gibraltar, a bone of contention with Britain.

“If there is no exit agreement, bilateral accords between Spain and the UK are still in place,” Borrell said.

Spain had contingency plans in place to deal with a so-called hard Brexit, he said. The status of British citizens in Spain and Spanish citizens in Britain would not change substantially in the case of a hard Brexit, Borrell said.

There are some 300,000 British citizens, many of them pensioners, living in Spain, while around 130,000 Spaniards reside in the British isles.