The Trump administration signaled on Wednesday that it is exploring a "path forward" to add a question on U.S. citizenship to the 2020 census, despite a Supreme Court decision last week that appeared to have effectively blocked the government from going ahead with the controversial change.

The Justice and Commerce departments said on Tuesday that printing of census forms that did not include the question had already begun. But later Tuesday night, President Trump said he had ordered the departments to do "whatever necessary" to include the question, and pushed back against the notion that his administration had abandoned plans to do so.

"I have asked the Department of Commerce and the Department of Justice ... to do whatever is necessary to bring this most vital of questions, and this very important case, to a successful conclusion," he wrote on Twitter.

Get Breaking News Delivered to Your Inbox

In a conference call on Wednesday with Judge Jarrod Hazel of the District of Maryland, Assistant Attorney General Jody Hunt confirmed the Justice Department is now looking into whether the addition of the question is still "viable and possible."

"We at the Department of Justice have been instructed to examine whether there is a path forward, consistent with the Supreme Court's decision, that would allow us to include the citizenship question on the census. We think there may be a legally available path under the Supreme Court's decision," Hunt said on the call, according to a transcript provided to CBS News by an attorney for the plaintiffs. The transcript was first published by Talking Points Memo.

Hazel, the judge, asked the government's attorneys about the president's tweet, pointing out it "directly contradicted" what the Justice Department had told the court on Tuesday. Josh Gardner, a Justice Department attorney, said the government had not meant to mislead the court and suggested the lawyers were caught off guard by the president's tweets.

"The tweet this morning was the first I had heard of the president's position on this issue, just like the plaintiffs and your honor. I do not have a deeper understanding of what that means at this juncture other than what the president has tweeted," Gardner said. "But, obviously, as you can imagine, I am doing my absolute best to figure out what's going on."

Hazel set of a deadline of 2 p.m. Friday for the government to decide whether it intends to scrap the citizenship question or move forward in court.

Mr. Trump tweeted again on the morning of July 4th, insisting employees are working hard at the DOJ and Commerce Department, even on the federal holiday.

"So important for our Country that the very simple and basic 'Are you a Citizen of the United States?' question be allowed to be asked in the 2020 Census. Department of Commerce and the Department of Justice are working very hard on this, even on the 4th of July!" the president tweeted.

In a separate case in New York, the Justice Department confirmed the department has been ordered to examine ways to add the question, which immigrant advocates and Democrats have said is designed to benefit the electoral prospects of Republicans.

"The Departments of Justice and Commerce have now been asked to reevaluate all available options following the Supreme Court's decision and whether the Supreme Court's decision would allow for a new decision to include the citizenship question on the 2020 Decennial Census," Justice Department lawyers wrote in a letter to Judge Jesse Furman of the Southern District of New York.

The attorneys said both the Commerce and Justice departments are conducting an "analysis" on whether the administration can ask the Supreme Court for "procedural guidance" to expedite litigation. If the Commerce Department crafts a new rationale for adding the citizenship question, the officials said they will immediately notify the high court and ask it to make a new decision.

Following the Supreme Court's 5 to 4 ruling vacating Commerce Secretary Wilbur Ross' decision to add the question, Justice Department officials and Ross confirmed the questionnaire for next year's count had been sent to the printer without the question on U.S. citizenship. But the officials on Wednesday said those announcements were made with the available information at the time.

"That representation was based on the information undersigned counsel had at the time, and it remains undersigned counsel's understanding that the process of printing the questionnaires, without the citizenship question, continues," they wrote, while acknowledging the printing of the forms has begun.

Kathryn Watson and Clare Hymes contributed reporting.