Reza Yosefi, 20, has lived in Sheffield for the past four years and claims he has never lived in Afghanistan, though his parents were born there.
The European Court of Human Rights had previously blocked his removal in November “until further notice”.
A spokesman for the UK Border Agency said that ruling had now been lifted.
The agency said Mr Yosefi was not in need of protection.
Mr Reza said he felt “confused and scared” after being detained.
Campaigner Marishka Van Steenbergen said he was held after signing on at the Home Office base at Vulcan House, Sheffield.
Son of refugees
She said a letter he was given told him his removal from the UK was imminent as he had not provided satisfactory evidence of his identity, nationality or lawful basis to be in the UK, and had previously refused to leave the UK when he had been required to do so.
Jeremy Oppenheim, regional director for the UK Border Agency, said:
“Both the UK Border Agency and the courts have fully considered Mr Yosefi’s case and have found he is not in need of protection and must return to Afghanistan.”
“Throughout his claim, Mr Yosefi has consistently informed the UK Border Agency and the courts that he is from Gazni in Afghanistan.”
“Where someone is found not to be in need of protection we expect them to return voluntarily.
“If they do not we will seek to enforce their removal from the UK.”
Mr Yosefi has claimed he grew up in Iran as the son of illegal Afghan refugees, before fleeing to the UK.
He said he arrived as an asylum seeker when he was 16, after a seven-month journey.
As a minor he was looked after by social services in Sheffield but once he turned 18 he was refused permission to remain indefinitely.
Mr Yosefi said that because his parents are considered illegal immigrants in Iran they have no Iranian citizenship and he has been told he must return to Afghanistan – but he has no family or friends there.