Trump said his administration is exploring a number of legal options, but the Justice Department did not say exactly what options remain now that the Supreme Court has barred the question at least temporarily.
The government has already begun the process of printing the census questionnaire without that question.
The administration's focus on asking broadly about citizenship for the first time since 1950 reflects the enormous political stakes and potential costs in the once-a-decade population count that determines the allocation of seats in the House of Representatives for the next 10 years and the distribution of some $675 billion in federal spending. It also reflects Trump's interest in reshaping how congressional districts are drawn.
"You need it for Congress, for districting," he said Friday. "How many people are there? Are they citizens? Are they not citizens? You need it for many reasons."
Districts now are based on the total population. Some Republicans want them based on the population of eligible voters, a change that could disadvantage Democrats by excluding immigrants. The Supreme Court has left open the issue of whether districts based only on the population of eligible voters is constitutional.
The Census Bureau's own experts have said a citizenship question would discourage immigrants from participating in the survey and result in a less accurate census that would redistribute money and political power away from Democratic-led cities where immigrants tend to cluster to whiter, rural areas where Republicans do well.
Trump, speaking as he departed the White House for a weekend in New Jersey, said he might take executive action.
"It's one of the ways that we're thinking about doing it, very seriously," he said.
An executive order would not, by itself, override court rulings blocking the inclusion of the citizenship question. But such an action from Trump would perhaps give administration lawyers a new basis to try to convince federal courts that the question could be included.
"Executive orders do not override decisions of the Supreme Court," Thomas Saenz, president and general counsel of the Mexican American Legal Defense and Educational Fund, said in a statement Friday. The organization is representing plaintiffs in the census lawsuit in Maryland.
Later Friday, Justice Department lawyers formally told U.S. District Judge George Hazel in Maryland the administration is not giving up the legal fight to add the citizenship question to the next census. But they also said it's unclear how they will proceed, according to a court filing.
"They still say they don't have clear instructions on what to do," said Saenz, who took part in a conference call with the judge and lawyers for both sides in one of three lawsuits seeking to keep the question off the census. The other two are in New York and California.
Hazel had expressed mounting frustration with the mixed signals the administration was sending, first telling him on Tuesday that the question was off only to have Trump tweet the next day that the administration was "absolutely moving forward" with efforts to include the question.
Friday evening, the American Civil Liberties Union asked a federal judge in New York to permanently block the administration from adding the citizenship question to the 2020 census.
"The Trump administration repeatedly argued the census forms could not be altered after June 30. They've now changed their tune because the Supreme Court ruled against them. They can't have it both ways," said Dale Ho, director of the ACLU's voting rights project.
Trump's administration has faced numerous roadblocks to adding the question, like last week's Supreme Court ruling that blocked its inclusion, at least for now. Both the Justice and Commerce departments indicated on Tuesday that they were moving forward with the census, minus the citizenship question.
But Trump has insisted otherwise, pushing his administration to come up with a way to include the controversial query. He suggested Friday officials might be able to add an addendum to the questionnaire with the question after it's already printed.
In the Supreme Court's decision last week, Chief Justice John Roberts joined the court's four more liberal members in saying the administration's current justification for the question "seems to have been contrived."
The administration had pushed the Supreme Court to decide the case quickly, citing a July 1 deadline to begin printing the forms. The court made the rare move of taking up the case directly from a trial court in New York before an appeals court had weighed in. As recently as June 20, Solicitor General Noel Francisco reminded the justices of the need for a quick decision, writing that "for all practical purposes, the Census Bureau needs to finalize the 2020 questionnaire by June of this year."
The Trump administration had said the question was being added to aid in enforcement of the Voting Rights Act, which protects minority voters' access to the ballot box.
But the question's opponents say recently discovered evidence from the computer files of a Republican redistricting consultant who died last year shows that, far from helping minority voters, discrimination against Hispanics was behind the push for the citizenship question.
Hazel on Friday gave the plaintiffs in the Maryland claim until Aug. 19 to gather more evidence and take testimony from administration officials. If Hazel finds discrimination, that could be a separate basis for blocking the citizenship question.
Preparations for the $15.6 billion 2020 Census are intricately choreographed. More than 425,000 people have already started applying for the half million positions needed for the 2020 Census. The bureau also is in the middle of a test run, with 480,000 households sent questionnaire information, according to the bureau's monthly status report from May.
The ongoing legal wrangling itself could hurt the census, said John Yang, president and executive director of Asian Americans Advancing Justice. The group is a plaintiff in the Maryland case. "The government is trying to sow seeds of confusion in the public," Yang said.
Associated Press writers Michael Kunzelman in College Park, Maryland, and Michael Schneider in Orlando, Florida, contributed to this report.