* Conservative Roberts joins liberals in 5-4 ruling
* Critics call citizenship query a partisan Republican ploy
* Trump faces uphill battle to include question in census (Adds Trump administration reaction, ACLU quote, quote from Justice Roberts, details on next steps)
By Lawrence Hurley and Andrew Chung
WASHINGTON, June 27 (Reuters) - The U.S. Supreme Court on Thursday handed President Donald Trump a stinging defeat, ruling that his administration gave a "contrived" explanation for its plan to include a contentious citizenship question in the 2020 census in a decision that will make it difficult to add the query to the population survey.
Conservative Chief Justice John Roberts wrote the 5-4 ruling and joined the court's four liberals in the majority, upholding part of a federal judge's January decision barring the question in a victory for a group of states including New York and immigrant rights organizations that had challenged the plan.
Critics have called the citizenship question a Republican ploy to scare immigrants into not taking part in the decennial population count and engineer an undercount in Democratic-leaning areas with high immigrant and Latino populations. That would benefit non-Hispanic whites and help President Donald Trump's party gain seats in the U.S. House of Representatives and state legislatures, the critics said.
Trump's administration has told the courts that its rationale for adding the question was to better enforce a law that protects the voting rights of racial minorities. Critics called that rationale a pretext, with the Supreme Court's majority embracing that theory.
Roberts said that under a U.S. law called the Administrative Procedure Act, the federal government is required to give a reasoned explanation for its actions. Roberts said the sole stated rationale - enforcement of the Voting Right Act - "seems to have been contrived" and was "more of a distraction."
"We are presented, in other words, with an explanation for agency action that is incongruent with what the record reveals about the agency's priorities and decision-making process," Roberts wrote.
"Accepting contrived reasons would defeat the purpose of the enterprise," Roberts added.
As part of the ruling issued on the last day of the court's current term, the justices sent the issue back to the Commerce Department for it to decide whether to provide a different rationale for requiring people taking part in the census to declare whether they are citizens.
The clock is ticking, with the administration previously saying that census forms needed to be printed in the coming days. A determination from a federal agency normally would take weeks or months.
"There is really no time. And if the administration tries to rush it that is clearly a red flag," said Dale Ho, a lawyer with the American Civil Liberties Union, one of the challengers.
Jason Torchinsky, a lawyer and Republican redistricting strategist, said the deadline could be extended to the fall, which would enable the Supreme Court to review the new decision.
"They don't need to redo the entire administrative process, they just need to better justify what they did, in a way that can satisfy the Supreme Court," Torchinsky said.
Justice Department spokeswoman Kelly Laco said the administration is disappointed by the Supreme Court's decision. "The Department of Justice will continue to defend this administration's lawful exercises of executive power," Laco said in a statement.
The census, required by the U.S. Constitution, is used to allot seats in the U.S. House and distribute some $800 billion in federal funds. Opponents have said the question would instill fear in immigrant households that the information would be shared with law enforcement, deterring them from taking part.
Further muddying the waters, there is also ongoing litigation in lower courts over recently unearthed evidence that the challengers have said reveals an illegal discriminatory motive by the administration for adding the question, which the high court could yet weigh in on.
The court ruled against the challengers in a separate 5-4 vote, with all the conservative justices in the majority, that the U.S. Constitution does not in theory prevent the administration or a future one from adding a citizenship question.
In a dissenting opinion, conservative Justice Clarence Thomas wrote that adding a citizenship question is "legally sound" and described the ruling against Trump as "an aberration."
The Republican president's administration had appealed to the Supreme Court after lower courts blocked the inclusion of the census question.
SETBACK FOR TRUMP
The ruling marked the first major setback for Trump in a ruling in a case argued at the Supreme Court, although both of Trump's appointees, Justices Neil Gorsuch and Brett Kavanaugh, voted in favor of his administration. Roberts was joined by liberal Justices Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor and Elena Kagan.
The Supreme Court had handed Trump some major victories since he took office in 2017, in particular a June 2018 ruling upholding his travel ban targeting people from several Muslim-majority countries. The court in January also let Trump's policy barring many transgender people from the U.S. military go into effect.
Manhattan-based U.S. District Judge Jesse Furman ruled on Jan. 15 that the Commerce Department's decision to add the question violated the Administrative Procedure Act. Federal judges in Maryland and California also have issued rulings to block the question's inclusion, saying it would violate the Constitution's mandate to enumerate the population every 10 years.
Furman said the evidence showed that Commerce Secretary Wilbur Ross concealed his true motives for adding the question and that he and his aides had convinced the Justice Department to request a citizenship question.
Citizenship has not been asked of all households since the 1950 census, featuring since then only on questionnaires sent to a smaller subset of the population.
The Census Bureau's own experts estimated that households corresponding to 6.5 million people would not respond to the census if the citizenship question were asked.
While only U.S. citizens can vote, non-citizens comprise an estimated 7 percent of the population.
Evidence surfaced in May that the challengers said showed that the administration's plan to add a citizenship question was intended to discriminate against racial minorities.
Documents created by Republican strategist Thomas Hofeller, who died last year, showed that he was instrumental behind the scenes in instigating the addition of the citizenship question. He was an expert in drawing electoral district boundaries that maximize Republican chances of winning congressional elections.
Hofeller concluded in a 2015 study that asking census respondents whether they are American citizens "would clearly be a disadvantage to the Democrats" and "advantageous to Republicans and Non-Hispanic Whites" in redrawing electoral districts based on census data.
Hofeller suggested the voting rights rationale in the newly disclosed documents.
The Trump administration called the newly surfaced evidence "conspiracy theory."
Most people living in the United States will be asked to fill out the census, whether online or on paper, by March 2020.
For a graphic on major Supreme Court rulings, click https://tmsnrt.rs/2V2T0Uf For a graphic on the U.S. census, click https://graphics.reuters.com/USA-CENSUS/010092JZ39N/index.html
(Reporting by Lawrence Hurley; Additional reporting by Andrew Chung, Nick Brown and David Shepardson and Bryan Pietsch; Editing by Will Dunham)
Our Standards: The Thomson Reuters Trust Principles.