Updated

A three-judge panel from a federal court in New York has blocked President Trump’s order to exclude counting illegal immigrants for the purpose of redrawing congressional districts.

The panel ruled that the move would violate the law and granted an injunction halting it.

They also blocked Commerce Secretary Wilbur Ross, who runs the department that oversees the Census Bureau, from excluding illegal immigrants when turning over data to be used to calculate the number of House seats each state receives.

TRUMP DEFENDS DOWNPLAYING CORONAVIRUS AMID WOODWARD BOOK UPROAR, SAYS BIDEN USING PANDEMIC FOR 'POLITICAL GAIN'

“The Presidential Memorandum violates the statutes governing the census and apportionment in two clear respects,” the judges wrote in their opinion. “First, pursuant to the virtually automatic scheme established by these interlocking statutes, the Secretary is mandated to report a single set of numbers — “[t]he tabulation of total population by States” under the decennial census — to the President, and the President, in turn, is required to use the same set of numbers in connection with apportionment.”

President Donald Trump speaks to the press before boarding Air Force One for a trip to a campaign rally in Freeland, Mich., Sept. 10, in Andrews Air Force Base, Md. (AP Photo/Evan Vucci)

The lawsuit was brought by dozens of states, including New York, the American Civil Liberties Union and other groups in response to a July 21 order from Trump that sought to exclude illegal immigrants from being counted in the 2020 Census.

CLICK HERE TO GET THE FOX NEWS APP

Historically, the total population has been used to calculate congressional representation, whether residents are citizens or not, the judges wrote.

“This is a huge victory for voting rights and for immigrants' rights. President Trump has tried and failed yet again to weaponize the census against immigrant communities," Dale Ho, director of the ACLU's Voting Rights Project, said in a statement. "The law is clear — every person counts in the census.”