Image copyright Getty Images

Brexit Secretary Stephen Barclay has asked the EU to consider a separate agreement on citizens' rights in the event of no deal.

About 1.3m UK citizens live in one of the other 27 EU member states, while the UK hosts about 3.2m EU nationals.

Theresa May's Brexit deal covers citizens' rights but it has not yet been approved by MPs.

The EU has previously said the best way to safeguard citizens' rights would be to agree the withdrawal agreement.

Tory MP Alberto Costa, who has campaigned on the issue, told the BBC Mr Barclay's intervention was "better late than never."

He resigned from his job as aide to Scottish Secretary David Mundell in February to put forward an amendment calling for the prime minister to write to the President of the European Council, Donald Tusk, to seek to guarantee the rights of EU nationals, even if a Brexit deal is not agreed.

The amendment was put forward with cross-party backing of 141 MPs - and it was accepted by the government without a vote.

"The UK government has finally taken seriously the Costa amendment and with the spectre of no deal appearing ever closer, the UK government are worrying about how to protect the rights of British citizens in the EU," he said.

Image copyright UK Parliament Image caption Alberto Costa has campaigned on the issue of citizens' rights

Mr Costa said it was important to reach a separate deal on citizens' rights "given that we will shortly have a new prime minister with very little time to negotiate anything of substance with the EU ahead of the 31 October deadline".

"Failure, will result in a total loss of rights for British nationals in the EU, confusion over pensions and welfare access, and undoubtedly a tsunami of litigation against the failure of the UK govt to protect their rights."

Mr Costa is calling on all of the leadership candidates to commit to changing the law as soon as possible should they win.

Only Michael Gove so far has promised to do so and has received the backing of Mr Costa as a result.

In a letter to Michel Barnier - the EU's chief Brexit negotiator - Mr Barclay welcomed the EU's commitment that "no UK national will be left in the dark".

However, he added "there remain gaps in a number of areas and in a number of member states."

"I believe we collectively have an opportunity to address these concerns and that we should make sustained efforts to do so," he wrote.

He also suggested there was "gathering support from parliamentarians in the European Parliament and other member states" for a ring-fenced citizens' rights agreement.

Settled status

Mr Barclay previously wrote to the EU to seek such an agreement in March.

Responding to that letter, Mr Barnier wrote the "best way to safeguard the rights of the citizens affected by the UK's withdrawal is to have the withdrawal agreement ratified so that it can enter into force".

He added that it would be far from straightforward to identify which provisions would need to be "carved-out as part of the ring-fencing exercise".

EU citizens who were in the UK before Brexit can apply for settled status, which allows them to continue to live and work in the country.

Citizens rights: What is covered in the withdrawal agreement?

UK citizens in the EU - and EU citizens in the UK - will retain their residency and social security rights after Brexit.

Citizens who take up residency in another EU country during the transition period, including the UK, will be allowed to stay in that country after the transition.

Anyone who stays in the same EU country for five years will be allowed to apply for permanent residence.

What if there is a no-deal Brexit?

Mrs May has said EU citizens in the UK will be able to stay even if there is no deal done.

In that scenario, those with a right to permanent residence - which is granted after they have lived in the UK for five years - should not see their rights affected.

There is uncertainty, though, about what no deal would mean for Britons living in France, Spain, Germany and elsewhere. The priority for most will be to register as residents, but the rules - including deadlines for paperwork - vary from country to country. More details here.