A judge sided with the Trump administration on Thursday in ruling that an Alabama woman who joined the Islamic State group was not a US citizen, leaving the 25-year-old and her son in limbo in Syria.

Hoda Muthana, an American-born woman who left Alabama to join Isis in 2014, has said she “deeply regrets” joining the terrorist group and wants to return to the US with her young son.

Reggie Walton, a federal judge in Washington, agreed with the government’s position that Muthana’s father was still a diplomat when she was born, making her ineligible for US citizenship, a lawyer for Muthana said.

The lawyer, Christina Jump, said she was waiting to read the written ruling and that the Constitutional Law Center for Muslims in America, which is representing Muthana, would look at further options.

The US grants citizenship to virtually everyone born on its soil and it is extremely difficult to revoke a person’s citizenship.

But as Muthana’s case grew in prominence, Trump tweeted that Muthana was not a US citizen and would not be allowed to return.

The US secretary of state, Mike Pompeo, later explained that Muthana’s father had been a diplomat representing Yemen at the UN, meaning that his daughter was never a US citizen even though she traveled to Syria on a US passport – which she appeared to torch in a propaganda message.

Muthana’s lawyer stressed that the judge based his ruling on the issue of diplomatic immunity.

“The court did not base its ruling on a tweet by the president, or by any supposed proclamation made by any official,” Lamb said.

“United States citizenship cannot be revoked by tweet or any other form of social media, and today’s ruling does not change that,” she said.

Muthana was raised in Hoover, Alabama, a prosperous suburb of Birmingham, and says she was brainwashed through her smartphone by messages from Isis.

In Syria, she reached out to a global jihadist audience through social media and married three foreign fighters, all of whom died in combat.

Muthana says she has reformed and is willing to face prosecution in the US, where she wants to return for the sake of her two-year-old son.

“Anyone that believes in God believes that everyone deserves a second chance, no matter how harmful their sins were,” Muthana told NBC News in a recent interview from her displacement camp.

“I did not support the [Isis] beheadings from day one, until now I do not support any of their crimes and suicide attacks,” Muthana said.

The US has repatriated several Americans but not Muthana.

The court case comes as the US struggles to persuade European allies – who can more easily legally revoke citizenship – to repatriate their fighters from Syria.