The issue has only been exposed now because a young woman, referred to as LL, brought a test case after she was refused legal aid for immigration advice in April last year, even though the government had already found her to be a potential victim of trafficking.

She wanted to apply for discretionary leave to remain, an immigration status that can give people a temporary right to stay in the UK if they have suffered extreme hardship.

The Anti-Trafficking and Labour Exploitation Unit, a charity providing legal support to victims, was given permission to judicially review the legal aid decision in her immigration case.

The day before the full hearing last month the MoJ reached an agreement that it had, in fact, misinterpreted the law.

Carita Thomas, a solicitor at the Anti-Trafficking and Labour Exploitation Unit, which brought the case, told BuzzFeed News: “This shows there’s no joined-up thinking for the protection of victims of modern slavery across government. One aim of government was making a decision that had a hugely negative impact on victims’ ability to access the rights they deserved to have – and another arm of government didn’t know anything about it.”

The government is now under pressure to reveal how many trafficking victims were denied the free legal advice to which they were entitled.

Thomas said: “There were other cases. I don’t have a statistic about that and the LAA refused to publish anything which would say.”

Meg Hillier MP, the chair of the powerful public accounts committee, which on Wednesday published a report into modern slavery, told BuzzFeed News: “The court ruling shows that victims of modern slavery need to have proper legal support. Access to justice is now decided by the ability of someone to pay, and who needs access to justice more than vulnerable victims of trafficking?”

She also said that while May’s “flagship” Modern Slavery Act had made big promises, it had not yet delivered: “It arrived with much trumpeting four years ago but we haven’t yet seen the delivery.”

The government will now decide if LL was definitely trafficked into Britain – and whether she can have a visa to stay and recover from her experience in safety.

The Legal Aid, Sentencing and Punishment of Offenders Act (LASPO) 2012 took legal aid away from almost all immigration cases. But cases relating to detention, asylum, and trafficking victims were supposed to be the exception.

BuzzFeed News revealed earlier this year that the number of people given public funding to fight an immigration case is now lower than at any time on record. Just 6,609 people were given legal help or representation in their immigration case in the three months to September last year.

Richard Burgon, shadow justice secretary, said: “The government's cruel decision to deny legal aid for trafficking victims created unnecessary suffering and distress.