Amber Rudd has lost a legal battle over her attempts to deport a key witness to a controversial death at a UK immigration centre. Jamaican Andrew Van Horn was due to be expelled from from the country this week, despite the likelihood that he would be summoned to appear at an inquest into the death, and to a separate police investigation.

Q&A What are enforced departures? Show There are three layers of state-enforced or enforceable departures of immigrants from the UK: deportations, administrative removals and voluntary departures. Deportations apply to people and their children whose removal is deemed 'conducive to the public good' by the home secretary. They can also be recommended by a court.

Administrative removals refer to cases involving the enforced removal of non-citizens who have either entered the country illegally, outstayed a visa, or violated the conditions of their leave to remain. Voluntary departures are people against whom enforced removal has been initiated; the term 'voluntary' simply describes how they leave. There are three sub-categories: a) Those who depart via assisted voluntary return schemes.

b) Those who make their own travel arrangements and tell the authorities. c) Those who leave without notifying the government.

On Tuesday a high court judge ruled against Rudd, ordering that Van Horn should be allowed to remain in the UK because he “may well be required to give evidence at the inquest of a fellow detainee” and the Home Office had not offered any assurances that he would be allowed to return to the UK to give evidence.

Lawyers said the approach by Rudd, who is battling for her career over the continued fallout of the Windrush generation scandal “offended fundamental principles concerning the rule of law” and compromised the state’s duty to adequately investigate deaths in custody.

Jamaican citizen Carlington Spencer

Carlington Spencer, 38, from Jamaica, died last October at Morton Hall immigration removal centre in Lincolnshire, one of a cluster of deaths that prompted the home affairs select committee to investigate the facility.

The court papers say: “The claimant [Van Horn] was one of the first people to see Spencer on the day he suffered from a stroke; he was a direct witness who can confirm his observations of Spencer’s symptoms earlier that day, an issue that may be contentious amongst the interested persons and highly relevant to the investigations conducted by the coroner, police, PPO [Prisons and Probation Ombudsman] and clinical review team.”

Van Horn, 47, claims Spencer, a friend, did not receive prompt medical attention on the day he died and had complained of feeling ill. He believes Rudd wanted to deport him because of his potential testimony in the inquest and criminal investigation. “They want to shut me up, they want to move me on because I’m one of the main witnesses and they don’t want me on the case,” he said.

Van Horn, who arrived in the UK in 1984 aged 14, was due to be automatically deported after being convicted in 2012 for attempting to cause grievous bodily harm with intent, added: “I feel like I’m being persecuted. Ever since I came into the situation with Carlington, they are persecuting me more than normal.”

Q&A Have you been affected by abuse in an immigration centre? Show If you have experienced or seen abuse in an IRC you can tell us about using our encrypted form here.

Only the Guardian will have access to your contribution and one of our journalists may contact you to discuss further. You can also contact the Guardian securely via WhatsApp by adding the contact +44(0)7867825056.

Court documents reveal that, days after Spencer’s death, the coroner requested Rudd not to deport Van Horn until it had been established whether he would give evidence at the inquest.

The home secretary is named in the documents as an “interested person” because “she was responsible for Spencer’s wellbeing at the time of his death, having detained him under immigration powers”.

The papers say: “The inquest will consider whether her [Rudd’s] actions may be shown to have caused/contributed to the death.”

Court papers also outline that testimony from Van Horn is potentially crucial because it might help shed light on whether the actions of government employees “may be shown to have caused/contributed to the death”. A Lincolnshire police investigation into the death is continuing, although it is unclear when the investigation will be complete and the evidence reviewed by the Crown Prosecution Service.

Toufique Hossain, Van Horn’s lawyer at solicitors Duncan Lewis, said: “While platitudes and apologies are issued by the home secretary for her government’s risible treatment of the Windrush generation, her officials proceed undeterred in unlawfully detaining and unlawfully removing individuals, thanks to the culture within her department.”

Hossain added: “There is to be an inquest to determine whether the Home Office caused or contributed to the death of a person in her custody. Our client is a potential key witness to that inquest, whom she has sought to remove from the territory. Such action by the secretary of state offends fundamental principles concerning the rule of law. This isn’t hostile, it’s dangerous.”

Van Horn, currently being held at Brook House immigration centre near Gatwick, also said that he has information relating to another death at Morton Hall, that of a 27-year-old Iraqi believed to have killed himself in November. “I wrote to the manager of Morton Hall, saying that the guy was on suicide watch. They definitely want me out of the country,” said Van Horn.

In relation to the death of Spencer, The court papers addsay: “The claimant [Van Horn] was one of the first people to see Spencer on the day he suffered from a stroke; he was a direct witness who can confirm his observations of Spencer’s symptoms earlier that day, an issue that may be contentious amongst the interested persons and highly relevant to the investigations conducted by the coroner, police, PPO [Prisons and Probation Ombudsmancorrect] and clinical review team.”

Irène Nembhard of Birnberg Peirce, lawyer for the Spencer family, said: “The family are very pleased that the witnesses’ continued presence in the UK will mean they can hope for an inquest that will get to the heart of the worrying circumstances into how he died.”

The Ministry of Justice would not comment while a PPO investigation into Spencer’s death, to be followed by the inquest, is continuing. The Home Office said it would be inappropriate to comment during an active investigation.