A US federal judge has blocked the Trump administration’s latest attempt to restrict birthright citizenship for some children born in the United States, ruling that they remain subject to US jurisdiction and are entitled to citizenship under the Constitution.

In an order issued on Wednesday, District Court Judge Christopher Cooper said the children were covered by the 14th Amendment. “The president cannot carve out new exceptions to birthright citizenship for children born within the United States and subject to its laws,” Cooper wrote.

The case was brought by several rights groups on behalf of children affected by Trump’s executive orders in August. The administration sought to deny citizenship to children in certain categories whose parents, it argued, were not subject to US jurisdiction.

A court in Maryland blocked the same policy in September, issuing a preliminary injunction. The latest ruling adds to setbacks for Trump’s effort to end birthright citizenship for children whose parents were neither US citizens nor legal permanent residents when they were born.

The administration has argued that the 14th Amendment—which grants citizenship to all “persons born or naturalised in the United States, and subject to the jurisdiction thereof”—was not intended to cover parents who were not permanently living in the country.

The case followed a June US Supreme Court ruling striking down Trump’s initial order on birthright citizenship. The court said the lawmakers who drafted the 14th Amendment understood the breadth of its language and did not limit it as the president sought to do. Trump, who personally attended arguments in that case, has said he was unhappy with the ruling.

The Supreme Court cited an 1898 case involving Wong Kim Ark, a US-born Chinese American who was denied citizenship. His parents had returned to their native China after his birth, and when Wong came back to the United States as an adult, officials denied him entry on the grounds that he was not considered a citizen.

After the June ruling, Trump issued another order targeting “birth tourism”—when women travel to the US to give birth so their children can obtain automatic citizenship. It also covered children whose parents work for foreign governments or international organizations without diplomatic immunity, as well as children with a parent classified as an “alien enemy”.

“The president needs to accept that birthright citizenship is the law of the land,” said Cody Wofsy, a lawyer with the American Civil Liberties Union, one of the groups representing the plaintiffs. “The Supreme Court has twice rejected efforts to gut birthright citizenship, in 1898 and again earlier this year. Third time is not the charm.”

White House spokeswoman Lauren Bis called the decision “just another ruling from an activist judge” and said Trump’s order had been “consistent with the holdings and analysis set forth by the Supreme Court”.

The Migration Policy Institute estimated in a study last year that about 255,000 babies born annually to parents who were unauthorised immigrants or on temporary visas—and who would have been covered by Trump’s initial executive order—would have been denied citizenship if the Supreme Court had upheld that policy.

The 14th Amendment was ratified in 1868, after the US Civil War, and automatically made people born to formerly enslaved people citizens. Its broad language also covered other people born in the country, an interpretation US courts have said was consistent with English traditions predating the founding of the United States. Indigenous people were treated as an exception because they had some legal autonomy; Congress passed a law granting them citizenship in 1924.

Since taking office, Trump has pursued a broad immigration-restriction agenda, limiting visas and political asylum for much of the world and directing federal law enforcement agencies to crack down nationally on allegedly undocumented immigrants. His administration has also brought lawsuits seeking to strip naturalised people of citizenship if they committed major crimes and concealed that history from authorities.