(WASHINGTON) — President Donald Trump’s attempt to exclude unauthorized immigrants from the census count violated the law, a federal court in New York ruled on Thursday.

The three-judge panel determined that the secretary of Commerce, who oversees the Census Bureau, could not leave out people living in the country illegally from the population totals used to determine congressional seats.

“The Presidential Memorandum violates the statute governing apportionment because, so long as they reside in the United States, illegal aliens qualify as ‘persons in’ a ‘State,"” the judges wrote.

Legal challenges were brought by a group of Democratic-led state attorneys general and a coalition of immigrant rights groups led by the American Civil Liberties Union, which described the order as a “xenophobic effort to deny the basic humanity of undocumented immigrants.” Lawyers for the groups said the directive “openly and obviously” violated the Constitution.

“This is a huge victory for voting rights and for immigrants’ rights,” said ACLU attorney Dale Ho, who argued the case. “President Trump has tried and failed yet again to weaponize the census against immigrant communities.”

The decision comes amid a fundamental debate over whether the census can be conducted accurately given the delays caused by the coronavirus health crisis.

Last week, a federal judge in California temporarily barred the Trump administration from winding down census operations in a case that challenged the decision to cut the count a month shorter than originally planned to accommodate for delays caused by the pandemic.

Critics of the administration are concerned the decision to adhere to a shorter deadline will result in undercounting low income and rural communities that are typically harder for census workers to reach. The Gila River Indian Community near Phoenix and the Navajo Nation both joined the lawsuit against the administration to preserve the deadline extension.

“It is not an exaggeration to say an accurate census can be a matter of life or death in tribal communities because the programs impacted by census count affects delivery of health care, public safety, our youth and elder programs, housing, violence against women grants and other programs that sustain our tribal communities,” Stephen Roe Lewis, governor of the Gila River Community, told the House Oversight Committee on Thursday.

In the same hearing, John Thompson, who ran the Census Bureau from 2013 to 2017, told the committee that the agency needs more time to collect data from hard to reach localities. Census experts have warned that if the bureau is forced to conclude counting too quickly it will result in a count that cannot be certified as accurate.

“I am extremely concerned that the actions that have been taken to truncate 2020 census data collection activities by Sept. 30, 2020, will adversely affect the quality and accuracy,” Thompson said.

A Government Accountability Office report late last month characterized the decision to expedite the count after its delay as “a risk” to accuracy. It also found the bureau has struggled to hire and retain staff needed to convince residents to answer and participate.

“I think it will be an enormous challenge for the Census Bureau to deliver counts that meet the increasing historical demands for accuracy and completeness,” GAO Managing Director J. Christopher Mihm told House lawmakers on Thursday.

Copyright © 2020, ABC Audio. All rights reserved.