A British-born woman who went to Syria as a schoolgirl to join Islamic State should not be allowed to return to Britain to challenge the government taking away her citizenship because she poses a security risk, the UK’s Supreme Court ruled on Friday.

Shamima Begum left London in 2015 when she was 15 and went to Syria via Turkey with two school friends where she married an IS fighter.

Begum, 21, who is being held in a detention camp in Syria, was stripped her of her British citizenship in 2019 on national security grounds, but the Court of Appeal ruled last year she could only have a fair appeal against that decision if she were allowed back to Britain.

The country’s top court unanimously overturned that decision, meaning that although she can still pursue her appeal against the citizenship decision, she cannot do that in Britain.

“The right to a fair hearing does not trump all other considerations, such as the safety of the public,” said Robert Reed, the President of the Supreme Court. “If a vital public interest makes it impossible for a case to be fairly heard, then the courts cannot ordinarily hear it.”

Begum’s case has been the subject of a heated debate in Britain, pitting those who say she forsook her right to citizenship by travelling to join IS against those who argue she should not be left stateless but rather face trial in Britain.

After travelling to Syria, she lived in Raqqa, the capital of the self-declared caliphate, where she remained for four years until she was discovered in a detention camp.

She has had three children since leaving Britain, but all the infants have since died, and she is now in the Roj camp, run by Syrian Kurdish authorities, where the U.N. rights experts said this month conditions were “sub-human”.

Reed said Begum’s appeal should be stayed until she was in a position to play an effective part in it without endangering the public.

“That is not a perfect solution, as it is not known how long it may be before that is possible. But there is no perfect solution to a dilemma of the present kind,” he said.

Human rights groups said Britain had a duty to bring back Begum and those like her, and prosecute them, rather than making it someone else’s problem.

“Abandoning them in a legal black hole – in Guantanamo-like conditions – is out of step with British values and the interests of justice and security,” said Maya Foa, director of campaign group Reprieve.