In this March 19, 2020, file photo, the US census logo appears on census materials received in the mail with an invitation to fill out census information online in San Anselmo, California.
CNN  — 

A federal court is rebuking and blocking President Donald Trump’s directive to exclude undocumented immigrants from the census count that’s used to allocate seats in Congress.

The court ruled Thursday that the President’s July order violates the federal laws that set out how congressional seats are apportioned, and granted a permanent injunction blocking the rule. The court did not decide if the President’s memorandum violates the Constitution.

“We declare the Presidential Memorandum to be an unlawful exercise of the authority granted to the President by statute,” the three-judge panel unanimously ruled.

The order is the second blow to the Trump administration’s census policies this month. Over the Labor Day weekend, a federal judge in California blocked the administration from immediately winding down census operations. She is hearing a challenge to the administration ending census counting on September 30, a month earlier than when it redesigned census operations because of the coronavirus pandemic.

The President’s July memorandum did not change who would be counted in the 2020 census, which counts every person. But it directed Commerce Secretary Wilbur Ross to provide the President with a count of the entire population and a second tally that excludes “aliens who are not in a lawful immigration status.”

The order followed the Trump administration’s failed effort to ask about the citizenship status of every person during the census count. The administration abandoned the plan after the Supreme Court ruled it did not believe Ross’ justification for asking the question – to enforce voting protections – and sent the administration back to the drawing board.

In the wake of that effort, Trump directed the Census Bureau to collect data on citizenship status from other government agencies. His July order instructed the government to meld that data with 2020 census records.

The apportionment challenge was filed by nearly two dozen states, multiple cities and counties, and multiple groups representing minority groups or advocating for a successful census count.

At a court hearing earlier this month, the government argued that the order was within its rights to determine how to make the apportionment tally. But the groups suing the government argued that their communities would lose political power and government funding because of the order.

“This is a huge victory for voting rights and for immigrants’ rights,” said Dale Ho, an attorney for nongovernmental groups in the lawsuit. “President Trump has tried and failed yet again to weaponize the census against immigrant communities. The law is clear – every person counts in the census.”

Sen. Brian Schatz, a Hawaii Democrat, said on Twitter that the order is “excellent news.”

“The Trump administration has been nakedly partisan and dishonest about their administration of the Census,” he said.