LONDON — Shamima Begum, who as a schoolgirl left her London home to join the Islamic State in Syria in 2015, lost a series of appeals before Britain’s Supreme Court on Friday that could have allowed her to return home to fight the removal of her citizenship, a move that could affect other British citizens held in detention camps in Syria.

Ms. Begum, now 21, hoped to return to Britain to appeal a 2019 decision by the British government to strip her of her citizenship, a move that could render her stateless. A lower court ruled last year that Ms. Begum could only be granted a “fair and effective appeal” by returning to Britain, but on Friday, the Supreme Court’s five judges unanimously denied her request to return.

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

The ruling could have far-reaching implications for other Westerners associated with the terrorist group who have remained in detention camps in northeastern Syria. That includes about 15 other British women who have also been stripped of their citizenship. Some, like Ms. Begum, have pleaded with the authorities to repatriate them so they could be prosecuted at home.

In dismissing Ms. Begum’s appeals, the Supreme Court handed a significant legal victory to the British government, and threw Ms. Begum’s fate further into limbo until the authorities assess the threat she may pose.

“Begum has never had a chance to make her case in court that she doesn’t pose a danger to society,” said Sarah St. Vincent, the executive director of Rights and Security International, an advocacy group. “Today’s decision will prevent her from doing so indefinitely and is unfair.”

Since the Islamic State lost its final foothold in Iraq and Syria in March 2019, more than 60,000 family members of Islamic State fighters have been detained in squalid camps, including 230 women from a dozen European countries and hundreds of children, according to the Brussels-based Egmont Institute.

Many have been detained with little legal basis, and the withdrawal of citizenship has created further obstacles to repatriation for some.

Their lawyers, relatives and right groups have periodically pressed the authorities to bring them home, but most European governments have resisted such calls, wary of the backlash they could face from the public, the challenges they may encounter in prosecuting the women and the risks for public safety that returnees could pose.

Countries like France, Belgium and Britain have repatriated some children on a case-by-case basis, but dozens who remain in the camps have died from malnutrition, hypothermia or various illnesses. Some have been victims of sexual abuse and abduction, according to human rights groups. A London-based organization has nicknamed the camps “Europe’s Guantánamo,” in a report documenting living conditions there last year.

Human rights experts at the United Nation this month urged 57 states, including Britain, to repatriate the families, citing the “unclear grounds” on which they were detained. Some 10 Frenchwomen who are detained in the camps started a hunger strike this week in an effort to put pressure on their government to bring them home.

“If some Western nations like Britain are facing difficulties in prosecuting their returnees, it will be as difficult for Kurdish authorities, which have limited evidence that these women have committed crimes,” said Thomas Renard, a researcher at the Egmont Institute. “So, do we keep them in illegal detention forever, without the prospect of a trial?”

Human rights organizations condemned the Supreme Court’s ruling against Ms. Begum.

“Barring Shamima Begum from Britain remains a cynical ploy to make her someone else’s responsibility,” said Maya Foa, the director of Reprieve, a London-based human rights group.

Ms. Begum was 15 when she boarded a flight to Turkey with two friends in February 2015, and entered Syria to join the Islamic State. She married a Dutch fighter and had three children, all of whom have since died.

She once said that she had no regrets about joining Islamic State but later said she was willing to change if she could keep her citizenship. Ms. Begum, who was born and raised in Britain, had a single nationality, but British authorities have argued that she could claim Bangladeshi citizenship through her mother.

Bangladeshi authorities have said they would not grant citizenship to Ms. Begum, meaning that the removal of her British nationality could leave her stateless.

In addition to humanitarian concerns, researchers have warned that the consequences of not repatriating citizens could outweigh the risks posed by their return. Some women have left the camps and are now unaccounted for, which could pose a threat of further radicalization. Lawyers have also argued that some could share valuable information about the Islamic State if interrogated at home.

Around 900 British nationals traveled to Syria and Iraq to join the Islamic State, and hundreds of them died there. Some 450 have since returned, and the authorities have prosecuted around 10 percent, far fewer than countries like Belgium, France and Germany. That has raised concerns about the level of evidence required to bring those individuals to trial.

At least nine British men and 16 women, along with around 35 children, remain in Syria, according to Reprieve. That includes Ms. Begum, whose case has ricocheted from one British court to another.

At a Supreme Court hearing in November, one of Ms. Begum’s lawyers argued that only in Britain could she properly mount her defense, because it was difficult to communicate with her defense team from Syria.

He also said the court’s assumption that she could pose a threat upon her return needed to be re-evaluated.

“It cannot be assumed that because Ms. Begum traveled to Syria to join ISIL, she is a continuing threat,” said the lawyer, David Pannick, using an acronym for the Islamic State.

Responding to the ruling, Priti Patel, Britain’s home secretary, said it affirmed the authority of her office “to make vital national security decisions.”

“The government will always take the strongest possible action to protect our national security, and our priority remains maintaining the safety and security of our citizens,” she said in a statement.