The home secretary, Theresa May, failed to protect three potential victims of trafficking who were locked up in an immigration detention centre, a high court judge has ruled.

The three test cases on trafficking are linked to a series of other legal challenges which have successfully argued that the detention of asylum seekers while their claims are being decided is unlawful because it has failed to protect vulnerable people.

The three victims who challenged the home secretary were a 22-year-old Albanian woman forced into marriage with a man who wanted to traffic her, a 49-year-old Nigerian woman forced to have sex with her husband’s friends, and a Nigerian boy who was brought to the UK on a sports visa through the John Fashanu Foundation programme and claimed to have been tortured, raped and trafficked.

May has admitted that she failed to correctly identify victims of trafficking, failed to make appropriate referrals to police and trafficking authorities, and allowed the detained fast track (DFT) procedure to operate in a discriminatory way.

Under the procedure, people seeking asylum in the UK who are considered suitable for fast-tracking, often on the basis of their country of origin, are detained while their claim is determined.

Mr Justice Blake ruled on Monday that all three claimants had been detained unlawfully by May.

Stephanie Harrison QC, who acted for two of the claimants, said: “It isn’t without some irony that only a few months ago the modern slavery act came into force heralded by the home secretary as offering protection to victims of trafficking being criminalised.

“The Home Office now needs to adhere to the law and its own commitments on trafficking and urgently review the asylum system so victims of trafficking are no longer detained and denied vital protections.”