Shamima Begum, a British-born woman who left the country as a teenager in 2015 to join the Islamic State, will not be allowed to return to the United Kingdom to fight a legal case about the revocation of citizenship, the country’s top court ruled Friday.

In a unanimous ruling, Britain’s Supreme Court found that Begum’s rights were not breached when she was refused permission to return by the British government. The decision overturned a ruling by a lower court last year.

Lord Robert Reed, president of the Supreme Court, said that national security concerns were paramount in the case. “The right to a fair hearing does not trump all other considerations, such as the safety of the public,” Reed said in a statement.

The ruling does not prevent Begum, now 21, from continuing her legal case against the British government’s decision to revoke her citizenship in 2019.

However, Begum’s lawyers have said she has not been able to freely communicate with them from the al-Roj detention camp, where she is being kept by Syrian Kurdish groups without trial, and that the possibilities of a fair case would be limited if held remotely.

Rights groups criticized the court’s decision on Friday. “Barring Shamima Begum from Britain remains a cynical ploy to make her someone else’s responsibility,” Maya Foa, director of the rights group Reprieve, said in a statement.

The decision is the latest development in a case that has divided Britons on questions of extremism, human rights and a government’s responsibility to its citizens. Its impact is likely to be felt by others who left Western nations to join the Islamic State.

In November, Rights and Security International reported that at least 15 women and 35 children from Britain were being held in Syrian refugee camps and that the British government had a “systematic policy of depriving women in the camps of their citizenship.”

The Brussels-based Egmont Institute has estimated that almost 1,200 Europeans were being held in camps in Syria and Iraq after the fall of the Islamic State, more than half of whom were children, with only limited efforts for repatriation.

While Begum’s case is the highest-profile citizenship revocation, the study said that other European nations — including Belgium, France, Denmark and the Netherlands — have stripped citizenship from Islamic State fighters.

The U.S. Justice Department announced in October that it had repatriated a total of 27 Americans from Syria and Iraq, including 10 who had been charged with terrorism-related crimes.

The year before, a court backed President Donald Trump’s claim that one U.S.-born woman was not a citizen, even though she held a U.S. passport, because of her father’s diplomatic status in the United States at her time of birth.

Rights groups said that visits to camps by British authorities showed it was possible to bring detainees back home.

“Like many of its European counterparts, the U.K. is more than capable of bringing home British detainees in Syria, many of whom left as teenagers after being trafficked or groomed online,” Foa said Friday.

Begum was 15 years old in 2015 when she joined two other schoolgirls and left Britain en route to Syria to join the Islamic State group. Her case immediately drew headlines in the British press, leaving many Britons horrified that girls so young would join a group known for extreme violence.

In 2019, as the Islamic State’s grip on its self-proclaimed caliphate was battered by coalition forces, Begum spoke to a reporter from the Times of London and asked the British government to help her return home. She was nine months pregnant at the time.

Although many people sympathized with the young woman, who was 19 at the time, others were dismayed by a number of comments she had made to British media outlets in interviews from the Syrian camp and her stated lack of regret about joining the Islamic State in the first place.

The British government announced that it would revoke her British citizenship on national security grounds that it did not make public. The government said she would not be stateless, as Begum’s family has roots in Bangladesh, although the Bangladeshi government said she was not eligible for citizenship.

Begum’s baby subsequently died about three weeks after birth in the camp, which is located in the far northeast of Syria near the borders with Turkey and Iraq. Begum bore three children after fleeing to the Islamic State, all of whom died young.

Britain’s Court of Appeal ruled last July that Begum could return to Britain to fight a legal battle over her citizenship. The British government appealed to the Supreme Court after the decision, saying that if Begum were allowed to return to the country, it would create “significant national security risks.”

In his statement to the media, Reed sided with the government’s assessment and criticized the Court of Appeal for making its own assessment of security concerns. He said Begum’s appeal could be delayed until she “is in a position to play an effective part in it without the safety of the public being compromised.”

That solution was not perfect, Reed acknowledged, “but there is no perfect solution to a dilemma of the present kind.”