The Home Office has apologised after around 100 letters were wrongly sent to EU nationals warning them they face detention and removal from the UK.
An urgent investigation has been launched into the error, which emerged after a Finnish academic posted about correspondence she received from the department on social media.
Eva Johanna Holmberg, who is married to a Briton, was told she had a month to leave. She was also warned that she was "liable to be detained".
Dr Holmberg, a visiting fellow at Queen Mary University of London, tweeted: "Home Office wants to deport a Finnish academic who is married to a Brit and pays taxes in Britain, i.e. me."
After her experience came to light, it was revealed that up to 100 similar letters had been sent.
A Home Office spokesman said: "A limited number of letters were issued in error and we have been urgently looking into why this happened.
"We are contacting everyone who received this letter to clarify that they can disregard it.
"We are absolutely clear that the rights of EU nationals living in the UK remain unchanged."
Critics attacked the department over the blunder, warning it would fuel further concern among the 3.2 million EU citizens living in Britain after the Brexit vote sparked uncertainty over their status.
James McGrory, executive director of Open Britain, said: "This is shameful stuff from the same department that gave us the disgraceful 'go home vans' a few years ago.
"It's little wonder that many EU citizens feel worried about their future status in the UK when they hear of people with every right to be here getting letters threatening their deportation."
Liberal Democrat home affairs spokesman Sir Ed Davey said the letters "shame Britain".
He added: "EU nationals who have made their lives here are already facing huge uncertainty over Brexit. It is appalling that some are now being officially threatened with deportation.
"This catastrophic error is a sign of the chaos and incompetence at the heart of this Conservative government."
Dr Holmberg originally applied for a "qualified person certificate" to confirm her right to live and work in the UK for "peace of mind".
Then last week she received the letter saying a decision had been taken to remove her from the UK.
The historian described her experience as a "Kafkaesque nightmare".
She told the Evening Standard: "How can an EU national be deported from the UK? There is free movement of people. It is just unbelievable. All for a piece of paper I don't even need."
Professor Simon Gaskell, president and principal of Queen Mary University of London, said: "Whilst it is clearly reassuring that the appalling position in which Dr Eva Holmberg was placed has now been resolved, we should be deeply concerned that such mistakes can be made – and, perhaps worse, that we live in times when they do not particularly surprise us.
"Dr Holmberg and her family should not have been subject to such stress, and it should not have been necessary for support mechanisms at Queen Mary University of London to be activated."
Prime Minister Theresa May said it was an "unfortunate error" by the Home Office, adding: "I understand they moved quickly to contact the people who had received these letters and assure them they were not going to be deported and I want to assure EU nationals here in the UK that their rights and status in the UK have not changed."