WASHINGTON—A deeply divided Supreme Court halted the Trump administration’s plans to ask U.S. residents on the 2020 census whether they are citizens, in a ruling Thursday that voiced blunt concerns about the White House’s motivations.

The court, in a strongly worded opinion by Chief Justice John Roberts, said Commerce Secretary Wilbur Ross, who made the decision to add a citizenship question, hadn’t explained his real reasons for doing so, leaving the legality of his actions in question, according to the Wall Street Journal.

When the court heard the case in April, a conservative majority seemed willing to give the administration leeway to ask all residents whether they were U.S. citizens, for the first time since 1950, despite the Census Bureau’s findings that the question would depress participation in immigrant households.

But on the final day of rulings in the court’s 2018-19 term, Chief Justice John Roberts found a middle ground: The addition would be legal, he said, if it were accompanied by a believable explanation.

Commerce Secretary Wilbur Ross’ stated reason — that a citizenship question would help the Justice Department enforce voting rights laws — “seems to have been contrived,” said Roberts, joined by the court’s liberal justices.

According to San Francisco Chronicle, Ross was “determined to recommend the citizenship question from the time he entered office,” and then pried a request for the addition from a reluctant Justice Department, Roberts said.

But in a separate 5-4 vote, Roberts and his fellow conservatives said a question about citizenship has a long history in the census and could be included even if one of the underlying motives was political. They gave Ross another chance to explain his decision in a lower federal court.

“A court may not set aside an agency’s policymaking decision solely because it might have been influenced by political considerations or prompted by an administration’s priorities,” the chief justice said. He said there should be no judicial “second-guessing the (commerce) secretary’s weighing of risks and benefits.”

Chief Justice John Roberts (second from right), shown during President Trump’s State of the Union address in February, indicated that the addition of the citizenship question would be legal if it were accompanied by a believable explanation.Photo: Alex Wong / Getty Images

While administration officials had previously insisted on a tight timeline, with printing of census questionnaires scheduled to start Monday, the Justice Department has suggested the timetable could be stretched until October. President Trump tweeted immediately after the ruling that he had “asked the lawyers if they can delay the Census, no matter how long,” to allow a final court resolution.

One legal commentator said Roberts seems to have given the Trump administration a road map to gain approval.

“He basically said, ‘Just don’t lie to my face,’” said Jessica Levinson, a professor at Loyola Law School in Los Angeles who specializes in election and governance issues. “It’s like telling a kid, ‘Go back and think of another reason why you want your candy.’ It feels like a very temporary win.”

But Glenn Smith, a constitutional law professor at California Western School of Law in San Diego, said the court might have trouble taking a new explanation seriously.

“I think it would take an extraordinary cleansing of the facts to make them reverse their course,” he said. “It would be surprising, and certainly sad, if having seen this pretext for what it is, the court knuckled under.”

Inclusion of the citizenship query would probably reduce participation substantially — by as much as 8%, according to Census Bureau researchers — in households with at least one noncitizen, regardless of legal status.

California, with more than 5 million noncitizens among its population of nearly 40 million, would stand to lose at least one congressional seat, and a corresponding vote in the Electoral College, along with tens of billions of dollars in federal aid. The federal government distributes $800 billion a year to state and local governments for education, infrastructure and social programs based on population.

California Gov. Gavin Newsom said he and other state officials will work to convince vulnerable immigrant communities that it is safe to participate in the census. California has set aside $187 million for outreach and other efforts to encourage a full census count in 2020, after spending just $2 million on the 2010 census.

“This has been delayed, but the Trump administration has not been denied the fear and anxiety that he has caused,” Newsom said.

Secretary of State Alex Padilla said Californians, by taking part in the census, “will resist the Trump administration’s attack on our fair share of federal funding and representation in Congress.”

State Attorney General Xavier Becerra said the court had told the Trump administration “what Ricky Ricardo always said to Lucy: ‘You’ve got some ’splainin’ to do.’”

Justice Department spokeswoman Kelly Laco said, “We are disappointed by the Supreme Court’s decision today. The Department of Justice will continue to defend this administration’s lawful exercises of executive power.”

Ross, whose department oversees the Census Bureau, announced in March 2018 that the once-per-decade census would include a citizenship question. He said the information would help the Justice Department enforce the Voting Rights Act’s protection for racial minorities by designing districts in which they would make up a majority of eligible voters.

But evidence uncovered by state and local governments indicated that Ross decided to add the question after meetings with immigration hard-liners, and he then encouraged the Justice Department to submit its request in December 2017. Ross also ordered the addition without conducting the field-testing that the Census Bureau has historically used before altering the census.

Newly uncovered computer files from Thomas Hofeller, a Republican redistricting expert who died last year, showed that he urged the incoming Trump administration to add the citizenship question and said it would be “advantageous to Republicans and non-Hispanic whites.”

U.S. District Judge George Hazel of Maryland said Monday that the new evidence could show that Ross had a discriminatory purpose, “diluting Hispanics’ political power.” On Tuesday, a federal appeals court said Hazel could consider additional evidence on the issue.

The Supreme Court’s liberal justices also referred to possible ethnic bias.

Adding a citizenship question would cause “a disproportionate number of noncitizens and Hispanics to go uncounted,” diminishing the accuracy of the census, Justice Stephen Breyer said in an opinion joined by Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan.

Smith, the Cal Western law professor, said discrimination can be hard to prove in such cases.

“It’s not enough to show a disproportionate effect on minorities” unless opponents can also prove the government had a discriminatory motive, Smith said. He noted that the Supreme Court, earlier in the case, had blocked an order by a New York federal judge requiring Ross to submit to a sworn deposition, which would have included questions about his motives.

In separate opinions Thursday, other conservative justices said the court should not have interfered with the decision.

“The federal judiciary has no authority to stick its nose into the question of whether it is good policy” or whether Ross’ stated reasons were “his real reasons,” Justice Samuel Alito wrote.

Justice Clarence Thomas, joined by Trump appointees Neil Gorsuch and Brett Kavanaugh, said the court “has opened a Pandora’s box of pretext-based challenges” to the government’s administrative decisions.