LONDON (AP) — A woman who ran away from London as a teenager to join the Islamic State group lost her bid Friday to return to the U.K. to fight for the restoration of her citizenship, which was revoked on national security grounds.

Shamima Begum was one of three east London schoolgirls who traveled to Syria in 2015. She resurfaced at a refugee camp in Syria and told reporters she wanted to come home, but was denied the chance after former Home Secretary Sajid Javid revoked her citizenship.

Begum’s lawyers appealed,, saying her right to a fair hearing was harmed by the obstacles of pursuing her case from the camp. The U.K. Supreme Court disagreed, ruling Friday that the right to a fair hearing does not trump all other considerations, such as public safety.

“The appropriate response to the problem in the present case is for the deprivation hearing to be stayed – or postponed – until Ms. Begum is in a position to play an effective part in it without the safety of the public being compromised,” said Justice Robert Reed, the president of the Supreme Court. “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.”

Javid argued that Begum was Bangladeshi by descent and could go there.

She challenged the decision, arguing she is not a citizen of another country and that Javid’s decision left her stateless.

The human rights group Liberty said the court’s ruling sets “an extremely dangerous precedent”.

“The right to a fair trial is not something democratic governments should take away on a whim, and nor is someone’s British citizenship,” said Rosie Brighouse, a lawyer with Liberty. “If a government is allowed to wield extreme powers like banishment without the basic safeguards of a fair tria,l it sets an extremely dangerous precedent.”