The official count of U.S. residents ought not be affected by politics. A federal court said as much last week in a ruling that wisely took the Trump administration to the woodshed over its ill-advised move to add a citizenship question to the 2020 census.

President Donald Trump’s Commerce Department, which develops the census forms, said early last year that it planned to add a yes or no citizenship question to the questionnaire. Critics of the move fear that adding such a query would cause many people in immigrant communities to see the census as a potential tool of immigration law enforcement and refuse to participate.

Since the administration announced the change, several legal challenges have been filed. In the most recent decision, New York federal Judge Jesse M. Furman ruled that Commerce Secretary Wilbur Ross acted in an “arbitrary and capricious” manner and violated laws governing the census.

Portions of Furman’s 277-page decision spoke directly to Ross, properly chastising him and his department for failing to justify departing from past census practice. The court added that Ross ignored laws requiring Congress to be notified three years in advance about adding a citizenship question to the national survey.

Furman’s ruling came in response to cases brought by the District of Columbia, 18 states, 15 large cities or counties and immigrants’ rights groups. They argued that if the citizenship question caused an undercount of populations in immigrant communities, those communities would lose representation in Congress and state legislatures, while being deprived of public funding in programs based on population. Plaintiffs in the New York case also argued that the question would lead to a population undercount in blue states.

Using census data, the court concluded that allowing that question could reduce participation in households with noncitizens by 5.8 percent or more. In Minnesota, state demographers estimate that if the question stands, a portion of the $8 billion the state receives annually from the federal government could be in jeopardy. And Minnesota and other states could lose congressional seats if noncitizens opted not to participate.

On behalf of the administration, the Justice Department argued that the change was reasonable because the question had been on the census before 1950. In addition, Ross said asking the question was necessary to help the government enforce the Voting Rights Act, which is intended to help increase representation for minorities and other underserved groups.

That rationale rings hollow coming from an administration that is working to roll back immigration. And as this Editorial Board has argued previously, collecting census data should not be subject to politics. Though some believe that noncitizens should not be counted — or represented — we disagree. Most adult immigrants, regardless of their status, are people who work, pay taxes, purchase goods and services, and otherwise contribute to the economy. Representation should not be tied to citizenship in a nation that has an estimated 12 million undocumented residents and another 22 million who are here legally but have not yet become citizens.

A 2016 unanimous U.S. Supreme Court decision affirmed that view. Justices said districts may be drawn based on total population — not just those eligible or registered to vote.

Conducting a census is mandated by the Constitution. Its vital purpose is to compile as accurate a count as possible of those living in the United States. That means everyone — not just citizens. Many aspects of American life are affected by census numbers, and a move to purposefully undercount a segment of the population is a bad idea. Those who want the most accurate census possible should hope courts presiding over the other pending challenges to the Commerce Department’s plan will follow Furman’s lead.