Peers handed Boris Johnson his first parliamentary defeat since the election by voting for EU citizens to be given physical proof of their right to stay in the UK after Brexit, to prevent “another Windrush”.

The House of Lords rejected ministers’ pleas that the move would amount to “ID card creep” – insisting it was necessary to guard against discrimination by employers, landlords and the state.

The vote – likely to be followed by further defeats over child refugees and lower courts ripping up EU laws – sets the scene for a showdown when the withdrawal agreement bill returns to the Commons.

The estimated 3.6m EU residents in the UK fear victimisation without physical documents after Brexit, including by immigration officials as happened in the Windrush scandal.

But the Home Office is insisting its ‘digital-only’ approach will be more secure, arguing physical documents “can get lost, stolen, damaged and tampered with”.

Peers also voted against the government on the issue of allowing British judges to overturn EU law, and further passed an amendment to allow cases to be referred to the Supreme Court to decide whether to depart from EU case law.

It means Conservative MPs will almost certainly be whipped to overturn the Lords defeat later this week, as the Bill is rushed through for Brexit Day on 31 January.

Angela Smith, the Labour leader, urged the prime minister to listen to the argument, saying: “I hope the prime minister and his colleagues will not think that they can get every detail of every bill right first time, and recognise that the second chamber is useful.

“A large Commons majority means the government is guaranteed to get its legislation through but it would be supremely arrogant to dismiss all scrutiny.”

And Jonny Oates, the Liberal Democrat peer, who tabled the key amendment, said it “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”.

Bizarre: Boris Johnson drives 'Brexit' digger through boxes Show all 8 1 /8 Bizarre: Boris Johnson drives 'Brexit' digger through boxes Bizarre: Boris Johnson drives 'Brexit' digger through boxes Conservative party leader Boris Johnson drives a JCB through a fake wall POOL/AFP via Getty Images Bizarre: Boris Johnson drives 'Brexit' digger through boxes Prime Minister Boris Johnson during a visit to JCB cab manufacturing centre in Uttoxeter, while on the General Election campaign trail. PA Photo. Picture date: Tuesday December 10, 2019. See PA story POLITICS Election. Photo credit should read: Stefan Rousseau/PA Wire Stefan Rousseau PA Bizarre: Boris Johnson drives 'Brexit' digger through boxes Britain's Prime Minister and Conservative party leader Boris Johnson drives a Union flag-themed JCB, with the words "Get Brexit Done" inside the digger bucket, through a fake wall emblazoned with the word "GRIDLOCK", during a general election campaign event at JCB construction company in Uttoxeter, Staffordshire, on December 10, 2019. - Britain will go to the polls on December 12, 2019 to vote in a pre-Christmas general election. (Photo by Ben STANSALL / POOL / AFP) (Photo by BEN STANSALL/POOL/AFP via Getty Images) BEN STANSALL AFP via Getty Bizarre: Boris Johnson drives 'Brexit' digger through boxes Prime Minister Boris Johnson sits in a cab of a JCB during a visit to its cab manufacturing centre in Uttoxeter, while on the General Election campaign trail. PA Photo. Picture date: Tuesday December 10, 2019. See PA story POLITICS Election. Photo credit should read: Stefan Rousseau/PA Wire Stefan Rousseau PA Bizarre: Boris Johnson drives 'Brexit' digger through boxes Britain's Prime Minister and Conservative leader Boris Johnson drives a Union flag-themed JCB, with the words "Get Brexit Done" inside the digger bucket, through a fake wall emblazoned with the word "GRIDLOCK", during a general election campaign event at JCB construction company in Uttoxeter, Britain, December 10, 2019. Ben Stansall/AFP/Pool via REUTERS POOL REUTERS Bizarre: Boris Johnson drives 'Brexit' digger through boxes A sign made for a visit by Prime Minister Boris Johnson to the JCB cab manufacturing centre in Uttoxeter, while on the General Election campaign trail. PA Photo. Picture date: Tuesday December 10, 2019. See PA story POLITICS Election. Photo credit should read: Stefan Rousseau/PA Wire Stefan Rousseau PA Bizarre: Boris Johnson drives 'Brexit' digger through boxes Britain's Prime Minister and Conservative party leader Boris Johnson drives a Union flag-themed JCB, with the words "Get Brexit Done" inside the digger bucket, through a fake wall emblazoned with the word "GRIDLOCK", during a general election campaign event at JCB construction company in Uttoxeter, Staffordshire, on December 10, 2019. - Britain will go to the polls on December 12, 2019 to vote in a pre-Christmas general election. (Photo by Ben STANSALL / POOL / AFP) (Photo by BEN STANSALL/POOL/AFP via Getty Images) BEN STANSALL AFP via Getty Bizarre: Boris Johnson drives 'Brexit' digger through boxes Britain's Prime Minister and Conservative party leader Boris Johnson reacts as he sits in the cab of a drives a Union flag-themed JCB, after driving through a fake wall emblazoned with the word "GRIDLOCK", during a general election campaign event at JCB construction company in Uttoxeter, Staffordshire, on December 10, 2019. - Britain will go to the polls on December 12, 2019 to vote in a pre-Christmas general election. (Photo by Ben STANSALL / POOL / AFP) (Photo by BEN STANSALL/POOL/AFP via Getty Images) BEN STANSALL AFP via Getty

"It would remove the risk that those who failed to meet the cut off deadline would be automatically criminalised and subject to deportation,” he added.

The government was defeated by 270 votes to 229, a majority of 41, as peers rejected the claim that digital proof of settled status would be robust and reliable.

Currently, ministers are offering only the ability to print out a letter confirming settled status, which would have no legal status.

But the3million group, representing EU citizens, says that would be vulnerable to forgery and no substitute for the biometric card issued to non-EU residents in the UK.

There are also fears for those who fail to achieve settled status by the cut-off date of June 2021, many of whom are older, less IT-literate, people, or children.

It was revealed last week that up to 900,000 UK-based EU nationals have yet to apply to secure their status.