The US Supreme Court has blocked the Trump administration from adding a question on citizenship to the 2020 census for the time being.
Chief Justice John Roberts joined the court's liberal justices, saying the administration did not provide adequate justification for the question.
The reason provided by the White House seem "contrived", the justices wrote in a 5-4 ruling.
The White House argued the question would help protect minority voters.
But the Census Bureau's own experts say it would lead to a major undercount.
Though the ruling deals a blow to the Trump administration, the complicated decision does not bar the question for either its language or the underlying premise.
Instead, by sending the case back to a lower court, Justice Roberts left open the possibility that the Trump administration could provide the necessary justification to add a question on citizenship to the census.
Following the ruling, US President Donald Trump called the decision "totally ridiculous".
Seems totally ridiculous that our government, and indeed Country, cannot ask a basic question of Citizenship in a very expensive, detailed and important Census, in this case for 2020. I have asked the lawyers if they can delay the Census, no matter how long, until the.....— Donald J. Trump (@realDonaldTrump) June 27, 2019
The battle over the 2020 census has played out across the US.
Civil rights groups have called it an attack on people of colour. Three federal judges have issued rulings to block the question, one calling it a threat "to the very foundation" of US democracy.
And though the Trump administration has maintained the question is necessary for an accurate national headcount, the majority decision pointed to a "disconnect between the decision made and the explanation given".
What is the citizenship question?
"Is this person a citizen of the United States?"
If the Trump administration eventually gets its way, federal law will require this question be asked of every living person in the US as part of the 2020 census.
A question on citizenship has not appeared on any US census since 1950.
The once-a-decade population count helps the US government draw up districts for state and local elections, and determine how much federal funding each state receives - a matter of hundreds of billions of dollars.
US Commerce Secretary Wilbur Ross - the billionaire financier who oversees the Census Bureau - testified to Congress last year that the request for the citizenship question came from the Department of Justice.
According to Mr Ross, the justice department needs more accurate data to enforce the Voting Rights Act, which protects minority voters.
In a 2018 report, Census Bureau researchers found that the inclusion of a citizenship question will likely suppress response rates in households with immigrants and minority groups, leading to a "lower-quality population count".
But Mr Ross has insisted that detailed citizenship data is of "greater importance than any adverse effect" posed by an undercount.
What's the controversy?
The battle over the 2020 census hinges on the motives underlying the new question.
The White House maintains the decision was made for practical reasons.
"When you have a census and you're not allowed to talk about whether or not somebody's a citizen or not, that doesn't sound so good to me," Mr Trump said to reporters in June.
But critics claim the question has more insidious origins. Democrats and civil rights groups say the question is politically motivated, meant to suppress responses from particular groups, namely immigrants and racial minorities.
"Is it really about citizenship?" said Michigan Democrat Rashida Tlaib. "No. It's about reducing the number of people of colour being counted in the census. That's exactly what it's about."
This suspicion has been fuelled by reports, released last month, that the question was the brainchild of a top Republican political consultant who argued it would help his party politically.
Redistricting strategist Thomas Hofeller, who died last August, had concluded in a 2015 study that adding the question to the 2020 census would create an electoral advantage for Republicans and "non-Hispanic Whites" by altering voting districts.
And released emails show that Mr Ross lobbied the justice department for a question on citizenship, contradicting his previous claims that the request originated from them.
The Supreme Court's decision appears to confirm Mr Ross's decisive role in pushing the question forward.
"Materials before us indicate that Commerce went to great lengths to elicit the request from DOJ (or any other willing agency", Justice Roberts wrote for the majority.
Congressional Democrats have recently ramped up efforts to access more documents that could shed light on the decision.
Last week, after the White House refused to hand over materials regarding the decision to ask the citizenship question, the House Oversight Committee voted to hold both Mr Ross and US Attorney General William Barr in contempt.
Why does it matter?
The Census Bureau's research indicates the citizenship question will dramatically reduce the number of people willing to participate, particularly among those who fear it could lead to deportation.
Adding the question could mean that up to 4 million people - mostly Latinos and African Americans - go uncounted, according to a study from the Urban Institute, a non-partisan research group based in Washington.
The "last-minute introduction" of a citizenship question has incited "a potential chill" among immigrants groups, the study said. Even in a lower-risk scenario, the 2020 count will be less accurate than previous years.
This will almost certainly favour the Republican party, at the expense of Democrats.
The US census determines the size of each state's congressional delegation, and shapes how congressional and state legislative boundaries are drawn within them. The census also guides how an estimated $880bn in public funding is distributed for schools, roads and other public services.
The states with the highest immigration populations, such as California, Texas and New Mexico, are at greatest risk of an undercount. These states all tend to vote Democrat.
Depressed response rates in these states will allow for electorate boundaries to be redrawn, pulling political power - and funding - away from Democratic-leaning, minority households.
The Supreme Court is expected to rule on the question this month, just in time for the Census Bureau to print out the 1.5bn questionnaires needed to begin the national headcount this summer.