The Home Office had ordered that commodities broker Ben James, 30, who has lived in Britain since being sent here as a 14-year-old schoolboy, be taken into custody and put on a plane to Lagos as an illegal overstayer.
But yesterday he was discharged from a detention centre near Gatwick Airport after the High Court ruled that he should be released on bail pending a judicial review of his case.
On his way back home to Peckham, south London, Mr James said: "I am elated. I am so pleased to be out and sleeping in my own bed tonight. There just aren't enough words to say thank you to the many people who have helped me."
During his seven days at Tinsley House detention centre, Mr James became desperate at the prospect of returning to a country where he no longer had friends or a common language.
He attempted to stab himself after immigration minister Mike O'Brien gave the go-ahead last Tuesday for him to be arrested and removed from the country within 48 hours.
Giving him permission to seek judicial review, deputy High Court judge David Pannick said yesterday he was "very troubled" that lawyers acting for Mr James had received no response to "the full and careful" representations they made on his behalf before he was arrested.
The judge was told by Stephanie Harrison, appearing for Mr James, that he was suffering from mental illness and had attempted self-harm while being held at Tinsley House detention centre.
Ms Harrison argued that the immigration authorities had not taken proper account of his medical condition, and of the "considerable community interest" in him being allowed to stay in the UK as an ethnic role model because of the business success he had achieved "in adverse conditions".
The judge ruled it was at least "arguable" that those factors had not been properly addressed by the Home Office, and ordered an urgent review of the full case, now likely to be heard before the end of July.
He added that the Home Office might in the meantime "give further consideration to this matter" and decide to reach a fresh decision. If that was done, the court would obviously have to decide the next step.
At the age of 14 Mr James, who now has no home or friends in Nigeria, was enrolled at a private school in south London by his father, who feared political persecution. Two years later he was forced to leave school when his parents stopped sending the fees.
Officially an illegal immigrant since the age of 17, he did menial work before establishing himself as a stockbroker.
A deportation notice was issued after he approached the Home Office voluntarily seven years ago to clarify his immigration status.Reuse content