The Trump administration’s addition of a citizenship question to the 2020 census was illegal, U.S. District Judge Jesse Furman ruled on Tuesday in a sprawling, meticulous 277-page opinion. Furman’s decision blocking the question from the census is a painstaking deconstruction of the Trump administration’s bad-faith argument. It is also a challenge to the Supreme Court which says, in essence: You cannot reverse my ruling without looking like hypocritical suckers.

Secretary of Commerce Wilbur Ross announced in March that the upcoming census will ask individuals about their citizenship status—a question not featured on the decennial census since 1950. It was a controversial move because the Constitution compels a tally of people, not citizens, and a citizenship question will provoke an “undercount” of racial minorities. Because many immigrants may refuse to reveal their citizenship status, for fear it could place them in legal jeopardy, states with large noncitizen communities will lose seats in the House of Representatives and Electoral College, as well as billions in federal funds.

Ross said that he added the question in response to a request by the Department of Justice, which asserted that the information would help it enforce the Voting Rights Act’s protections against minority-vote dilution. This claim makes no sense because federal courts do not use citizenship data to determine whether minorities’ votes have been unlawfully diluted. More importantly, though, the claim is untrue: The Commerce Department asked the Justice Department to propose the question, not the other way around. Ross demanded its inclusion, then lied to Congress about the question’s genesis.

This information, revealed through emails obtained during litigation, created a problem for Ross. So did the secretary’s sloppy handling of the matter. As Furman explained, Ross’ actions violated the law in several major ways. First, he ignored a 1976 statute that directs the secretary to “acquire and use” data from administrative records instead of adding “direct inquiries” to the census whenever possible. In other words, Ross had an obligation to determine that existing data would not suffice to accomplish his ostensible goals before adding a question to the census. But bizarrely, Ross did not even pretend to do so, or acknowledge this duty.

Because he “blatantly violated” this restriction, Furman concluded, his decision to add the question was “not in accordance with law.”

Second, Ross missed the deadline for reporting a new census question to Congress. The same 1976 statute requires the secretary to report new census questions and subjects to Congress at least three years before the census begins. He can only skirt this rule if he finds that “new circumstances exist which necessitate” an addition. Yet “there is no evidence,” Furman wrote, “that Secretary Ross ever made such a finding.” He simply disregarded congressional commands, a clear abuse of his authority.

Third, Ross ran afoul of the Administrative Procedure Act, which prohibits any agency action that is “arbitrary and capricious.” Furman found that Ross’ decision was arbitrary and capricious from top to bottom. In “a startling number of ways,” he wrote, Ross’ “explanations for his decision were unsupported by, or even counter to, the evidence before the agency.” The Census Bureau itself found that “the addition of a citizenship question to the census questionnaire would indeed materially reduce response rates among immigrant and Hispanic households.” Ross rejected this data on the basis of his own subjective belief that it probably wasn’t true. This speculation is “neither logical nor rational on its own terms,” Furman wrote. It just “makes no sense.” And by substituting his own conjecture for the evidence gathered by the bureau, Ross did not adhere to the law.

Fourth, Ross “failed to consider” whether the DOJ’s request was even plausible. The Census Act compels the secretary of commerce—not the DOJ—to decide when the collection of new census information is “necessary.” It does not permit the secretary “to outsource the decision” to “the unscrutinized discretion of another federal agency.”* Moreover, Furman found that the DOJ did not claim that citizen information was “necessary” to protect voting rights, but instead “studiously avoid using the word ‘necessary.’ ” So Ross purports to have uncritically trusted a different federal agency that did not even pretend that the data was vital to enforcing the Voting Rights Act—the key justification for the question. This, too, is arbitrary and capricious.

Fifth, Ross failed to justify “a dramatic departure from the standards and practices that have long governed administration of the census,” as required by the APA. “Making matters worse,” Furman wrote, “not only did Secretary Ross fail to justify these departures, but he and his aides took active steps to downplay, if not conceal, them from scrutiny.” His decision contradicts a federal law governing data collection, which directs agencies to maximize data quality while minimizing “respondent burden” as well as cost. Ross’ question will make the census more expensive while undermining the data’s quality and burdening respondents. Such an extreme departure from federal rules requires some justification—which Ross did not provide.

Eventually, the Supreme Court will probably rule on the case’s merits.

Sixth, and most importantly, “the evidence is clear that Secretary Ross’s rationale was pretextual.” Under the APA, a federal agency must clearly “disclose the basis” for its decisions. But “the real reason” for Ross’ decision “was something other than the sole reason he put forward.” Courts “have not hesitated to find that reliance on a pretextual justification violates the APA.” And here, Ross “decided to add the question for reasons entirely unrelated to VRA enforcement well before he persuaded DOJ to make its request.” He and his aides also “sought to conceal aspects of the process” and overruled “near uniform opposition” from experts. Ross’ pretextual falsehoods render the citizenship question unlawful.

Tuesday’s ruling will not be the last word on the census. In February, the Supreme Court will consider whether Furman was allowed to go beyond the official record to reach his decision—by, for instance, permitting the deposition of DOJ officials. But in his opinion, Furman explains that his conclusions do not rest on evidence beyond the official record. To the contrary, he notes that his findings are based on that record, and that all additional evidence only confirms those findings. Even if the Supreme Court decides that additional evidence was gathered improperly, the bulk of Furman’s ruling will stand.

Eventually, the Supreme Court will probably also rule on the case’s merits. And here, Furman lays out a challenge to the justices. In October, Justice Neil Gorsuch suggested that Ross was merely trying to cut through “red tape,” an astoundingly naïve view of his machinations. But the APA, Furman held on Tuesday, exists not to create “red tape” but “to protect core constitutional and democratic values.” This rebuke to Gorsuch lays out the stakes of the case: Will the courts defer to Ross and accept his screaming falsehoods? Or will they apply independent judgment and see the plain truth—that the Commerce Department violated the law?

In that sense, this case is a test of the Supreme Court’s consistency. The conservative justices, Gorsuch chief among them, routinely rail against federal agencies that exceed their statutory authority. They insist that courts scrutinize agency actions to confirm that they followed the text of the laws Congress passed. Here, Ross ignored those laws over and over again. If the Supreme Court’s conservative justices can’t recognize that fact, they will demonstrate a commitment to partisanship above law.

Correction, Jan. 15, 2019: Due to an editing error, this article originally misstated that the Census Act permits the secretary to outsource to another agency the decision of when new information is necessary to collect. It does not permit that.