People walk by Gibraltar's airport. Jon Nazca / REUTERS

The Spanish government will work to make things easier for British residents in Spain, even those without permanent residency status, in the event of a no-deal Brexit.

Madrid is planning to offer new residency papers to around 400,000 UK nationals if their country crashes out of the European Union without an agreement on the future relationship.

British residents in Spain will have to apply for a foreigner identity card before January 2021

This is one of the most salient measures contained in a contingency plan slated for approval by the Spanish Cabinet later today. Prime Minister Pedro Sánchez of the Socialist Party (PSOE) made the announcement on Wednesday during the last plenary session of Congress before the political term ends and a general election is held on April 28.

The decree extends all benefits to Gibraltar, although it underscores that Spain will have veto rights over the situation of the British Overseas Territory in any future agreement between London and Brussels.

All decisions that prolong the current status enjoyed by British citizens and businesses in Spain are made on condition that the UK will reciprocate with similar measures for Spanish residents in Britain.

After getting greenlighted by the Cabinet, the decree will be immediately sent to parliament for approval.

While it goes into great detail about less controversial measures such as citizen rights, the text of the decree only makes a broad mention of more complex issues, such as what will happen with Iberia flights between EU cities if the Spanish airline’s parent company, IAG, is no longer considered a European business.

The government is concerned about the approximately 9,000 Spanish workers who live in Campo de Gibraltar and cross over to “The Rock” every day

As for British residents in Spain, they will have to apply for a foreigner identity card before January 2021 to prove their legal residency status. For those who already have permanent residency, “the process will be nearly automatic.” For the others, there will be additional steps to take. The government estimates that around 400,000 people will receive new documents, on top of the 300,000 or so who are already registered.

The decree also stresses the need to guarantee the rights of British people working in Spain. The government hopes that the same will hold for the approximately 9,000 Spanish workers who live in Campo de Gibraltar and cross over to “The Rock” every day for their jobs. The executive says that any benefits for British workers in Spain “are subject to an equivalent treatment for Spanish cross-border workers.”

British civil servants who obtained a Spanish government job while their country was part of the EU will be allowed to keep their jobs.

On the trade front, some new customs rules may be introduced a few days before the UK’s exit date to prevent a sudden accumulation of work if there is no deal and British products automatically become third-country goods subject to duties and paperwork.