A federal court on Thursday blocked a memorandum signed by President Trump seeking to exclude undocumented immigrants from being counted in the census for apportionment saying such action would violate the statute governing congressional apportionment.

A special three-judge panel out of New York wrote that the president’s argument that undocumented immigrants should not be counted runs afoul of a statute saying apportionment must be based on everyone who is a resident of the U.S. The judges found that all residents must be counted for apportionment purposes regardless of their legal status.

The ruling came hours after a federal judge ordered the Trump administration to produce internal documents connected to its sudden decision to end the 2020 Census count a month earlier than the Census Bureau had planned.

U.S. District Judge Lucy Koh gave the government three days to file all documents and communications between mid-April, when the bureau said it would extend the count to Oct. 31 due to the pandemic, and Aug. 3, when it abruptly said the count would end Sept. 30.

By law, the state population totals that will be used to reapportion seats in the House of Representatives for the next decade must be delivered to the president by Dec. 31 of the census year.

The shortened timeline is at odds with statements from senior bureau officials who had said the bureau could no longer provide a complete and accurate count by the end of the year, and it sparked legal challenges. Koh last week temporarily blocked the bureau from winding down the count after the government said it had already started doing so, until a hearing set for Sept. 17.

Members of Congress have also expressed concern about the change in schedule, saying a rushed count will lead to an inaccurate census, particularly in areas already behind in being counted.

At a hearing of the House Oversight Committee on Thursday, Chairwoman Carolyn B. Maloney (D-N.Y.) questioned why the administration initially asked for the Oct. 31 extension and then reversed itself, even as an internal census document showed bureau officials warning that the shortened time would significantly damage the count.

“We do not have the full story,” she said, adding that statements from White House Chief of Staff Mark Meadows implied that the administration had reversed its request to try “to control apportionment this year while (Trump) is still in office.” Census data is used to reapportion House seats every 10 years, to guide redistricting and to distribute over $1.5 trillion in federal funding.

Maloney said an undercount would harm Republican states as well as Democrat ones. Noting that such states as Alabama, Arizona, Florida, Georgia, Kentucky, Montana, North Carolina, South Carolina, Texas and Utah could be harmed by an inaccurate count, she added, “That’s why a number of Republican senators have come out in support of extending the deadlines.”

A House coronavirus relief package approved the administration’s April request for a later end to the count that would have pushed the reporting deadline for apportionment to April 30. But a draft of a Senate coronavirus package has not included mention of the change. Congressional approval is required to change the reporting date.

Census experts have noted that the shortened count is only one part of the problem: The administration’s new timeline shortens the period for analyzing and correcting problems with the data from six months to three, and cuts out crucial steps from that stage.

Also on Thursday, Sen. Brian Schatz (D-Hawaii) and 19 other senators wrote to Census Bureau Director Steven Dillingham asking for details on how census data will be used to apportion House seats in light of the shortened count and a July presidential memo calling for undocumented immigrants to be excluded from the count, which sparked its own lawsuits.

“With the president’s unconstitutional memorandum excluding undocumented people from apportionment, coupled with your agency’s decision to end the 2020 Census count one month early, we also raise serious concerns about a fair and accurate distribution of congressional representation — a fundamental and crucial aspect of our constitutional democracy,” the letter said.

This is a developing story.