The government has been granted permission to fight a ruling that Shamima Begum should be allowed to return to Britain.
The Supreme Court will consider whether the former Isis bride can enter the UK for a legal battle over the removal of her British citizenship.
The Court of Appeal ruled against the government by granting Begum permission to launch a judicial review on 16 July.
But at a new hearing on Friday, judges said the home secretary’s case should be heard “as soon as reasonably practicable”.
Judges formally stayed the previous ruling, meaning that Begum cannot currently return to the UK from Syria.
The Court of Appeal heard that The Sun would be referred to the attorney general’s office for potential contempt of court proceedings because it published a story on the initial judgment before it was handed down.
The Government Legal Department is investigating who may have leaked the ruling.
The former London schoolgirl, who left the UK for Syria aged 15, lived under Isis rule for more than three years before being discovered in a refugee camp last February.
Begum was nine months pregnant when a journalist found her in the al-Hawl camp in northern Syria last year, and her baby son later died.
Sajid Javid removed her British citizenship and the government has used the same powers against dozens of alleged Isis members to prevent their return to the UK.
Begum’s lawyers appealed the decision, accusing the government of making her stateless and exposing her to the risk of death or inhuman and degrading treatment.
They appealed to the Special Immigration Appeals Commission (SIAC) but it ruled the move lawful and said Begum had not been made stateless in February.
But the Court of Appeal granted Begum permission to launch a judicial review against that decision, saying the only way to have a “fair and effective appeal” over her citizenship was to pursue it in the UK.
“Ms Begum should be allowed to come to the United Kingdom to pursue her appeal albeit subject to such controls as the Secretary of State [home secretary] deems appropriate,” a summary of the decision said.
In the full judgment, Lord Justice Flaux said national security concerns over Begum “could be addressed and managed” in the UK.
He added that Begum could be prosecuted if the threshold of evidence is met, or made the subject of a Terrorism Prevention and Investigation Measures (TPIM) order if not.
In a judgment agreed by Lord Justice Singh and Lady Justice King, Lord Justice Flaux said that “fairness and justice” outweighed national security concerns in the case.
Sir James Eadie QC, representing the Home Office, previously said the fact that Begum could not fully engage in the appeal procedure was a result of her decision to leave the UK, travel to Syria against Foreign and Commonwealth Office advice and align with ISIL [Isis].
SIAC ruled that the decision to revoke her British citizenship did not render her stateless and was lawful, as she was a citizen of Bangladesh by descent.
Jeremy Hunt says British officials didn’t rescue Shamima Begum’s baby because it was too dangerous. But in February 2019, Bangladesh’s ministry of foreign affairs said she was not a citizen and there was no question of her being allowed into the country.
In practice, this power means the Secretary of State may deprive and leave a person stateless if that person is able to acquire (or reacquire) the citizenship of another country.
The British government removed citizenship from 139 people for the public good between January 2016 and December 2018.
The figure for 2019, when Begum and other alleged Isis members including Jack Letts were deprived of citizenship, has not yet been published.
A statement said Begum had never visited the country or applied for dual nationality, and that the government was deeply concerned over the British government’s claims.
Government guidance states that the home secretary can deprive citizenship for the public good if a person can apply for alternative nationality.
This action may only be taken if the Secretary of State has reasonable grounds for believing that the person is able, under the law of a country outside the United Kingdom, to become a national of that country, says a document published last year.