Shamima Begum has lost an appeal against a decision to revoke her UK citizenship.
The Court of Appeal ruling means the 24-year-old must remain in Syria. The government stripped her citizenship on national security grounds in 2019.
Ms Begum left London nine years ago aged 15 to travel to Syria and join Islamic State group, or IS.
The ruling by three appeal judges was unanimous. It could still be challenged in the Supreme Court by Ms Begum.
Her solicitor Daniel Furner said that her legal team was "not going to stop fighting until she does get justice and until she is safely back home".
However the judges wholly dismissed all of Ms Begum's arguments - a highly significant rejection that could affect her ability to gain a full appeal at the Supreme Court.
Lady Chief Justice Baroness Carr said: "It could be argued the decision in Ms Begum's case was harsh. It could also be argued that Ms Begum is the author of her own misfortune.
"But it is not for this court to agree or disagree with either point of view.
"Our only task is to assess whether the deprivation decision was unlawful. We have concluded it was not, and the appeal is dismissed."
Who is Shamima Begum and how can you lose your citizenship?
As it happened: Shamima Begum loses appeal
Ms Begum's lawyers went to the Court of Appeal after losing a hearing last year. They argued that the Home Office's decision to remove her citizenship was unlawful, in part because British officials failed to properly consider whether she was a potential victim of trafficking.
In that hearing Sir James Eadie KC, for the Home Office, said the "key feature" in the case was national security.
"The fact that someone is radicalised, and may have been manipulated, is not inconsistent with the assessment that they pose a national security risk," he said.
The Court of Appeal ruling represents a substantial victory for the government and averts a potential legal crisis: were the decision to be reversed, home secretaries would in future need to balance national security considerations with questions of whether someone was a victim.
A bar chart showing that between 2010 and 2022, 220 people have been deprived of their British citizenship for the "public good". The highest year on record was 2017, when 104 people lost their citizenship. In comparison, only three people lost citizenship in 2022 – the latest year data is available.
Responding to the court's decision, the Home Office said it was "pleased" at Friday's ruling, adding that its "priority remains maintaining the safety and security of the UK".
A spokeswoman for the prime minister said the government would "always take the strongest possible action to protect our national security", adding that it never took decisions to remove citizenship lightly.
Outside court, however, Ms Begum's solicitors said that it was very likely they would ask the Supreme Court to get involved. A response however could take up to a year.
Gareth Peirce, of Ms Begum's legal team, said the UK was under a moral duty to take Ms Begum back, as other nations had with citizens found in Syria.
Begum (right) as she left London for Syria with two friends
IMAGE SOURCE,METROPOLITAN POLICE
Image caption,
Begum (right) as she left London for Syria with two friends
Ms Begum, born in the UK to parents of Bangladeshi heritage, was one of three east London girls who travelled to Syria in 2015 to support the IS group. She left with her friends Kadiza Sultana and Amira Abase.
Ms Sultana is thought to have died when a house was blown up. The fate of Ms Abase is unknown.
Ms Begum lived under IS rule for more than three years. She married a Dutch member of IS, who is currently held in a Kurdish detention centre, and lived in Raqqa, once a stronghold of the group. She had three children, all of whom have died.
She was found in al-Roj camp in northern Syria in 2019 following the defeat of IS, and remains there to this day.
Her lawyers say conditions in the camp have reached a "critical point", with "near starvation" and disease now seen daily.
"The fact of the matter is this - that Shamima, as with other British women and children, is arbitrarily detained in a prison camp in North East Syria," her lawyers said in a written statement on her behalf.
"It is not a refugee camp - those detained are unable to leave and the conditions have, with ever greater urgency, been categorised by every international body as well as by the UK courts in Shamima's case itself, as constituting torture and inhuman treatment."
Ms Begum has admitted knowingly joining a proscribed organisation. She said that she was "ashamed" to have done so and regretted it.