A twin boy born to American and Israeli same-sex parents was wrongly denied US citizenship when his twin brother was not, a US judge has ruled.

Andrew Dvash-Banks, a US citizen, and Elad, an Israeli, filed a lawsuit after the government only recognised one of their twin sons as a US citizen.

Their sons, Aiden and Ethan, were conceived using donor eggs.

Aiden was conceived using sperm from his American father and Ethan was conceived using sperm from his Israeli father, court records show. The boys were born two minutes apart from a surrogate mother in Canada in 2016.

The family sued the State Department for denying Ethan citizenship, drawing attention to a department policy that says that a child born abroad must be biologically related to an American parent to become a citizen.

The top 15 worst countries to be gay in Europe Show all 15 1 /15 The top 15 worst countries to be gay in Europe The top 15 worst countries to be gay in Europe 15. Italy Getty Images The top 15 worst countries to be gay in Europe 14. Macedonia Processed by: Helicon Filter; The top 15 worst countries to be gay in Europe 13. Poland Getty Images The top 15 worst countries to be gay in Europe 12. Liechtenstein The top 15 worst countries to be gay in Europe 11. Lithuania The top 15 worst countries to be gay in Europe 10. Latvia This content is subject to copyright. The top 15 worst countries to be gay in Europe 9. San Marino The top 15 worst countries to be gay in Europe 8. Moldova The top 15 worst countries to be gay in Europe 7. Belarus Getty Images The top 15 worst countries to be gay in Europe 6. Ukraine Getty Images The top 15 worst countries to be gay in Europe 5. Monaco The top 15 worst countries to be gay in Europe 4. Turkey Getty Images The top 15 worst countries to be gay in Europe 3. Armenia The top 15 worst countries to be gay in Europe 2. Russia Getty Images The top 15 worst countries to be gay in Europe 1. Azerbaijan Norway's Mette B. Bjerknaes competes during the Powerboat race on July 6, 2013 in Baku. Baku hosts the second race F2 World Championship 2013. The 2 mile course is designed just in front of the Baku Boulevard facing the Caspian Sea. AFP PHOTO / TOFIK BABAYEV (Photo credit should read TOFIK BABAYEV/AFP/Getty Images) Getty/AFP

Gay rights activists argued that the policy harms same-sex couples, who often use assisted reproductive technology to have children.

“Two kids who have almost identical life experiences and parenting,” said Aaron C Morris, a lawyer for the family and the executive director of Immigration Equality, a legal advocacy group that worked on the case. “To treat them differently is absurd.”

In a ruling on Thursday, Judge John F Walter of the US District Court for the Central District of California said Ethan should be recognised as a citizen since birth.

The judge ruled that federal law does not require a child born to married parents to prove a biological relationship with both parents.

The State Department said in a statement on Friday that it was reviewing the ruling, but did not respond to questions about what it would mean for the policy going forward.

The couple met in Israel and married in Canada in 2010, before having their sons with the help of assisted reproductive technology, according to their lawsuit.

After the twins were born, their parents went to the United States Consulate in Toronto to certify the children’s American citizenship and get US passports. But they were told that the twins had to take a DNA test to prove a genetic connection to Andrew, the lawsuit said.

Ethan was denied citizenship because Andrew was not his biological father, according to a copy of a letter from the State Department included in the lawsuit.

“If we were a straight couple and I was an Israeli woman and both of our names were on both kids’ birth certificates, would you ever require us to perform a DNA test?” Elad said in a video about the case posted by the immigration advocacy group.

When the family decided to move to Los Angeles to be near Andrew’s family in 2017, same-sex marriage had been legalised and three of the four family members were eligible to live in the United States.

But Ethan was allowed into the country only on a tourist visa, which expired that December, according to the lawsuit.

The couple sued the State Department the next month, with the help of Immigration Equality, the legal advocacy group, which works on behalf of LGBT immigrants and their families.

Mr Morris, the group’s executive director, said Ethan was living as a baby in California, which caused daily anxiety for the family and made it difficult for him to get to know his extended family in Israel.

“It took a very long time before he got to meet his grandparents,” Mr Morris said.

“When they did their taxes, they didn’t have a Social Security number for Ethan. Enrolling him in day care was complicated. This was an everyday frustration.”

In his ruling this week, Mr Walter called the State Department’s interpretation of the citizenship law “strained”.

But the ruling stopped short of striking down the State Department’s policy overall and does not necessarily apply to other families, according to Mr Morris.

Immigration Equality is fighting a similar case in Washington on behalf of a same-sex couple living in London.

Mr Morris said he hoped the ruling would be “persuasive” to other courts and would perhaps compel the government to change its policy voluntarily.

Support free-thinking journalism and attend Independent events

“It is one more in a series of cases telling the State Department that they are getting the policy wrong,” he said.

For the Dvash-Bankses, at least, the ruling brought fast relief. Afterwards, Elad and Andrew told their toddlers the news, as the boys chomped on bananas and smiled.

“Not knowing whether Ethan would be allowed to stay in the US is something we went to bed with every night,” Andrew said in a statement issued by the advocacy group.

“Now,” he said, “our family is whole and safe.”