WASHINGTON — The Trump administration is dropping plans to add a citizenship question to the 2020 U.S. Census, the Justice Department confirmed Tuesday, just days after the Supreme Court described the rationale for the question as “contrived.”

The decision to back away from the controversial question was a victory for civil rights advocates concerned that the query would lead to an inaccurate count of immigrant communities that could skew political representation and federal funding.

“In light of the Supreme Court’s ruling, the government had no choice but to proceed with printing the 2020 census forms without a citizenship question. Everyone in America counts in the census, and today’s decision means we all will,” said attorney Dale Ho of the American Civil Liberties Union, who argued the Supreme Court case.

The fate of the question has been the subject of legal and political wrangling since March 2018, when Commerce Secretary Wilbur Ross announced he planned to add it to the decennial survey, sparking a half-dozen lawsuits from states, cities, civil rights groups, and others.

Just last week, President Donald Trump responded to the Supreme Court's ruling temporarily blocking the question by saying he would seek to delay the census to give administration officials time to come up with a better explanation for why it should include a citizenship question.

Trump expressed disbelief again yesterday that "you're not allowed to ask whether or not somebody is a citizen."

"So we're trying to do that," he said in an interview with Politico.

Instead, government lawyers by email notified those challenging the planned census question of the administration’s decision to proceed without it.

Soon after the Supreme Court ruled against the administration, Justice Department officials said privately they determined they would have no choice but to drop the question from the 2020 census.

That is because the printer had a deadline that was merely days away, and officials knew there was no way that the court process could resolve favorably for them before that deadline, according to people familiar with the matter who spoke on condition of anonymity to discuss still pending litigation.

When Trump tweeted that he would explore delaying the census, some Justice Department officials were left scratching their heads, they said, because such a move would be legally impossible.

“I have to think that sanity prevailed with respect to the incredible disruption to our representational democracy that delaying the census would have caused,” said Terri Ann Lowenthal, a former staff director of the House census oversight subcommittee. “I doubt anyone at the Justice or Commerce Departments could figure out how to overcome the constitutional and statutory hurdles.”

Critics of the question, including some inside the Census Bureau, said it could cause an undercount of millions of people in immigrant communities who would be afraid to return the form, leading to an inaccurate count that could skew representation and apportionment in favor of Republican areas.

The government had said it needed the question in order to enforce the Voting Rights Act, and Ross initially told Congress he decided to add it in response to a December 2017 request from the Justice Department. But documents uncovered in the lawsuits suggested that Ross was pushing for it months earlier, and that he pressed the Justice Department to issue the request.

In its splintered ruling Thursday, the Supreme Court said federal agencies must offer “genuine justifications for important decisions, reasons that can be scrutinized by courts and the interested public,” wrote Chief Justice John G. Roberts Jr. in a section of his opinion joined by the court’s four liberal justices.

Information from the census, which every U.S. household is required to fill out, is used by businesses and by the government to allocate hundreds of millions of dollars in federal spending per year; it is also used to determine congressional apportionment and redistricting. The form that goes to all households has not included a question related to citizenship since 1950.

Thomas Wolf, of the Democracy Program at the Brennan Center for Justice, said Tuesday that the push to include such a question would have a lasting impact.

"Even if the citizenship question is dead, it has left damage in its wake. The question has not only distracted necessary attention for over a year from other key aspects of census preparation, but also raised widespread fears about the safety of participating in the census," Wolf said in an email.

"The administration must refocus its attention immediately on making sure that every person in this country is counted. It can start by launching a nationwide advertising campaign to ensure everyone that no citizenship question will appear on the 2020 Census."

The notice from the government came just hours before lawyers were scheduled for a conference call in a separate case in Maryland also challenging the census question.

Judge George Hazel, of the U.S. District Court for the District of Maryland in Greenbelt, was one of three federal judges who ruled against the question earlier this year, saying Ross violated administrative law and the enumeration clause of the Constitution by proposing to ask the citizenship status of household members on the form.

The issues before Hazel were different from those heard by the Supreme Court. The government's path to adding the question had become more difficult in May after new evidence emerged showing a deceased Republican redistricting strategist had been in touch with some administration officials over adding the question.

The strategist, Thomas Hofeller, was author of a 2015 study that found adding the question would likely help Republicans and white voters in subsequent redistricting decisions; he had also been in touch with a census official about adding a citizenship question to the form, according to files found on hard drives belonging to him.

Hazel had ruled that plaintiffs had not provided sufficient evidence for charges that the government had conspired or intended to discriminate when it added the question, and plaintiffs had appealed.

After the Hofeller evidence emerged, however, Hazel said the new evidence merited further consideration, and a federal appeals court returned the case to his court. The Maryland case could have tied up the question in a separate legal battle that might have eventually reached the Supreme Court in its own right.

Shankar Duraiswamy, the lead attorney in the Maryland case, called the Trump administration's reversal Tuesday a victory for American democracy.

"A citizenship question would have risked a massive undercount in areas with large numbers of Latinos and immigrants, depriving them of their right to equal political representation and fair share of federal funding," he said in an email.

The Washington Post’s Matt Zapotosky contributed to this article.