A federal judge on Tuesday blocked the Trump administration's plan to put a question about citizenship on the 2020 census, setting up the Supreme Court as the ultimate arbiter of whether it can remain on the nationwide demographics survey.

Placing the citizenship question on the survey has deep implications for U.S. elections, how many congressional seats each state receives, as well as federal funding levels.

For instance, if the citizenship question survives the long court battle, it could cost California several congressional seats by removing illegal immigrants from the re-districting population counts.

After a two-week trial in Manhattan, U.S. District Judge Jesse Furman said Commerce Secretary Wilbur Ross's decision to add the question about a person's legal status to the census violated the law and "the public trust," the Los Angeles Times reported.

"Hundreds of thousands—if not millions of people will go uncounted in the census if the citizenship question is included," Furman said in a 277-page opinion.

In ruling that the citizenship question is unlawful, Furman was referring to the Administrative Procedures Act, which requires an agency to "consider all important aspects of a problem," commission studies to produce relevant evidence for their conclusion and explain the facts behind a decision that carries such a significant impact on U.S. elections and funding decisions.

Ross's decision "fell short on all these fronts," the judge said.

Furman's ruling was a response to the first round of several lawsuits filed by numerous states and cities to block the question from the national, once-a-decade survey. The question was once included on the census but hasn't appeared since 1950.

White House press secretary Sarah Huckabee Sanders has defended the citizenship question as nothing out of the ordinary. She and other Trump administration officials have said it has been included in every census for decades.

Conservative advocates for its inclusion and others have pointed out that the citizenship questions has been included in the long-form questionnaire but not the short form since 1970. The short form goes to most households in America while the long form is sent to a much smaller sample of households, 1 in 6, and asks far more detailed questions on everything from household income to plumbing.

The long form also has not been used to determine the number of congressional districts each state should have.