The court's ideological divide was on full display, and its ruling, which is likely to come in June, could be its most important of the term. The decennial count of the nation's population determines the size of each state's congressional delegation, the number of votes it receives in the electoral college and how the federal government allocates hundreds of billions of dollars.
Unmentioned during the nearly 90-minute oral argument were the partisan stakes: An undercount estimated by census officials of about 6.5 million people probably would affect states and urban areas with large Hispanic and immigrant populations, places that tend to vote Democratic.
The census case was the most controversial Trump administration initiative to reach the high court since last year's 5-to-4 decision upholding the president's ban on certain travelers from a group of mostly Muslim countries.
That same five-member majority seemed again ready to defer to the executive branch, although every lower-court judge to consider the issue found that Commerce Secretary Wilbur Ross violated federal law and regulations in attempting to include the question on the census.
The lower-court judges starkly rebutted Ross' claim that the information was requested by the Justice Department to enforce the Voting Rights Act, which protects minorities, and they noted his consultations with hard-line immigration advocates in the White House beforehand.
The Supreme Court's liberal justices were just as skeptical.
"You can't read this record without sensing that this - this need is a contrived one," said Justice Elena Kagan. "There have been lots of assistant attorneys general in the [Justice Department's] Civil Rights Division that have never made a plea for this kind of data."
Justice Ruth Bader Ginsburg pressed Solicitor General Noel Francisco, representing the administration, on why the Census Bureau stopped asking a citizenship question after 1950. Ginsburg suggested it was because it reduced the compliance rate.
Justice Stephen Breyer noted that Census Bureau officials had testified that adding the citizenship question would result in "worse data."
Justice Sonia Sotomayor was Francisco's most dogged questioner, and at times the interaction between the two became tense. He was exactly 1 1/2 sentences into his presentation when she first challenged him, and the pattern continued.
She frequently cut in to debate him, setting the stage for an animated, sometimes technical discussion over the administration's objective and the impact it could have.
"Enumeration is how many people reside here," Sotomayor said. "Not how many are citizens."
She added later: "There's no doubt that people will respond less. If you're talking about prediction, this is about 100 percent that people will answer less."
Francisco said that Ross "understood there was a downside" to asking the citizenship question but also that the secretary felt there was more to gain from adding it.
"He concluded that the benefits outweighed the costs," Francisco said.
At one point, Sotomayor specifically mentioned the potential impact on Hispanics.
"Are you suggesting they don't have, whether it is rational or not, that they don't have a legitimate fear?" she asked.
Francisco said he was not suggesting that.
Three of the court's conservatives - Justices Clarence Thomas, Samuel Alito Jr. and Neil Gorsuch - indicated in an earlier iteration of the case that they were uncomfortable with the judicial branch playing a deciding role in which questions were asked or deleted.
"This gets really, really technical," Alito said.
When the secretary is faced with one method that has a 98 percent accuracy rate and another that might be even more accurate, "is it arbitrary and capricious for the secretary to say, I'll go with the 98 percent because that's a known quantity?" Alito asked New York Solicitor General Barbara Underwood. She was arguing on behalf of 18 states as well as cities and counties challenging Ross's decision.
Underwood said Ross' reasoning cannot survive scrutiny under the federal laws that dictate how such decisions are made.
"The secretary decided to add this question about citizenship to the 2020 Census although the record before him contained uncontradicted and strong evidence that it will cause a decline in the response rate of noncitizens and Hispanics, to the detriment of the states and localities where they live," she said.
The challengers' best hopes seem to be in convincing either Chief Justice John Roberts Jr. or Justice Brett Kavanaugh, Trump's most recent nominee to the court, to uphold the lower courts' decisions.
But both seemed more accepting of Francisco's arguments.
"Do you think it wouldn't help voting rights enforcement?" Roberts asked Underwood, telling her that it was "quite common" to add demographic questions to the census form.
Dale Ho, a lawyer for the American Civil Liberties Union, said it would not help with Voting Rights Act enforcement if the result was a census so riddled with incomplete information that it was distorted.
Kavanaugh asked questions of both sides, but he also seemed to lean toward recognizing the secretary's authority and that the citizenship question did not seem so unusual.
"The United Nations recommends that countries ask a citizenship question on the census," he said. "And a number of other countries do it. Spain, Germany, Canada, Australia, Ireland, Mexico ask a citizenship question."
"Does that international practice, that U.N. recommendation, that historical practice in the United States affect how we should look at the inclusion of a citizenship question in this case?" Kavanaugh asked.
Lawyers for the challengers said that the important thing was how the question would affect the 2020 Census and that there was universal agreement among experts that it would cause a problem.
Douglas Letter represented the Democratic-led House of Representatives, which is arguing the case alongside the states, and immigrant and civil rights groups. He urged the court to reject any change that would result in a less-accurate count.
Helping to enforce voting rights is important, "but it is not why the Census Bureau carries out an actual enumeration, which goes to the apportionment of representatives among the states and then distribution within the states," Letter said.
"So if there is something that undermines the accuracy of that count, even if it's important for other reasons, that is both a statutory violation and, therefore, a violation of the Administrative Procedure Act and a constitutional violation."
But Kavanaugh pointed out that Congress has a role to play.
"The statute that Congress has passed gives huge discretion to the secretary how to fill out the form, what to put on the form," he said.
If Congress is unhappy with the secretary's decision, "why doesn't Congress prohibit the asking of a citizenship question in the same way that Congress has explicitly provided that no one can be compelled to provide religious information?" Kavanaugh asked.
Letter began his presentation by telling Roberts that Speaker Nancy Pelosi, D-Calif., wanted to thank the court for allowing the House to intervene.
"Tell her she's welcome," Roberts said, prompting laughter in the courtroom.
"Thank you. I'll pass that along to her, Mr. Chief Justice," Letter said.
The case is Department of Commerce v. New York.
Sign up for the daily JWR update. It's free. Just click here.