The government has lost its first parliamentary vote since the election after being defeated in the Lords over EU citizens’ rights.
Peers voted by 270 to 229 to allow EU nationals to get a physical document or card as proof they have the right to live in the UK after Brexit.
Ministers want EU nationals to use a digital code, which will demonstrate their right to be in the UK.
They will aim to reverse the move when the Brexit bill returns to the Commons.
With a majority of the 80, the government will be confident of getting its way.
The EU Withdrawal Bill, which paves the way for the UK to leave the EU with a deal on 31 January, was approved by MPs earlier this month without any changes.
But despite their emphatic victory in December’s general election, the Conservatives do not have a majority in the Lords and suffered their first defeat during the bill’s passage through the unelected House.
The amendment passed by peers would give EU citizens in the UK the automatic right to stay, rather than having to apply to the Home Office, and would ensure they can get physical proof of their rights.
Its supporters said it would allay the “deep concerns” felt by many EU nationals who have until the end of June 2021 to apply for settled status.
More than than 2.7 million people have so far applied. Nearly 2.5 million of these have been told they can continue to live and work in the UK after Brexit, while six “serious or persistent” criminals have had their applications rejected.
No 10 has insisted that EU citizens will not automatically be deported if they fail to sign up to the scheme by the deadline.
But Lib Dem peer Lord Oates warned of a “plethora of problems” ahead for EU nationals and the government, saying physical proof of the right to reside would put a stop to that.
“This amendment simply seeks to uphold the promise repeatedly made by Boris Johnson that the rights of EU citizens to remain in the UK would be automatically guaranteed,” he said.
“It would remove the risk that those who failed to meet the cut-off deadline would be automatically criminalised and subject to deportation.”
Campaigners said the move could stop a repeat of the Windrush scandal, in which relatives of those who lawfully came to the UK from the Caribbean in the 1940s were threatened with deportation, and in some cases removed.
But the government said the system is working well, with 20,000 applications being made a day.
Following the vote, security minister Brandon Lewis insisted it would not rethink its approach.
He tweeted: “The EU Settlement Scheme grants EU citizens with a secure, digital status which can’t be lost, stolen or tampered with.”