President Trump announced Thursday he plans to sign an executive order regarding the collection of citizenship information, but the order will not involve the 2020 census. Instead, he ordered all federal government agencies and departments to provide data they have about citizens and non-citizens to the Commerce Department.

The move brings to an end a contentious legal battle over whether a question on citizenship could be included in the census, one that reached the Supreme Court.

"I'm hereby ordering every department and agency in the federal government to provide the Department of Commerce with all requested records regarding the number of citizens and non-citizens in our country," Mr. Trump said in remarks in the White House Rose Garden Thursday afternoon.

Get Breaking News Delivered to Your Inbox

The president lambasted "far-left Democrats" for trying to hide "the number of illegal aliens in our midst," claiming without citing evidence that the number of undocumented immigrants in the country is far higher than reported.

"We will defend the right of the American people to know the full facts about the population's size of citizens and non-citizens," Mr. Trump said at the beginning of his remarks, adding, "We have great knowledge in many of our agencies. We will leave no stone unturned."

Attorney General William Barr, accompanying the president along with Commerce Secretary Wilbur Ross in the Rose Garden, affirmed that the 2020 census will not include a question on citizenship. Barr explained that "the problem is that any new decision would be subject to immediate challenge."

"We're not going to jeopardize our ability to carry out the census," Barr said.

He also implicitly addressed criticism by some Democrats that the administration wanted to add a citizenship question to affect congressional apportionment, since the question could discourage immigrants from answering the census, which in turn could result in an undercount that could reduce the number of congressional seats in primarily Democratic states. Barr said that the question of citizenship could become relevant to congressional apportionment.

On the sidelines of a Latino citizens conference Thursday, some of the 2020 candidates hoping to take on Mr. Trump spoke to CBS News' Ed O'Keefe about the citizenship information collection plans announced by the president.

Massachusetts Sen. Elizabeth Warren sees it as an effort by the president to scapegoat migrants. "He is trying to say in a hundred different ways, if you have a problem in your life, blame the people who don't look like you, who don't sound like you, who don't pray like you, who weren't born where you were born. And that's what this is all about."

"So, he's lost on census. The courts have told him," Warren said. "We have to have a fair census count. That is the law. And so now he's just trying to do his runs. Who knows? He'll run it up, he'll move around. But the point is, we have a chance come 2020 to put an end to this."

Former Housing and Urban Development Secretary Julián Castro suggested to O'Keefe that the president's efforts were redundant. "The president should do his homework," he said. "We already have a citizenship question on the American communities survey that we do every year. It's easy to extrapolate from the work that the Census Bureau has been doing on this already."

What the U.S. doesn't need, Castro continued, is a "toxic question" that will "chill people from participating in what is supposed to be the most wide-ranging, most precise count of all of the people who are here in the United States."

The American Civil Liberties Union, which had threatened to fight any executive action attempting to place the citizenship question on the census, suggested Mr. Trump's ultimate move, said Mr. Trump's "attempt to weaponize the census ends not with a ban, but a whimper."

"He lost in the Supreme Court, which saw through his lie about needing the question for the Voting Rights Act. It is clear he simply wanted to sow fear in immigrant communities and turbocharge Republican gerrymandering efforts by diluting the political influence of Latino communities," Dale Ho, director of the ACLU's Voting Rights Project, said in a statement.

Leading up to the president's announcement there had been some uncertainty evident in the West Wing about what Mr. Trump would be signing. Earlier Thursday, administration officials had said Mr. Trump was planning on issuing an order to add the question to the census, but that had changed by late afternoon. Hogan Gidley, a White House spokesman, said the president had made a decision about what to do but "anything could change before 5 o'clock," when the president was scheduled to speak.

Administration officials inside the Justice Department had been expressing skepticism about the viability of an executive order to add the question to the census. A former Justice Department official told CBS News that career attorneys within the department knew that such an executive order would be unlikely to be upheld in court. And Barr initially agreed with career lawyers that it didn't make sense to further pursue the citizenship question after losing in the Supreme Court, the official said.

But when Mr. Trump insisted, Barr agreed to push forward in exploring the idea, even in the absence of a clearly viable way to do so. However, on Thursday, Barr dismissed reporting that Mr. Trump planned to add the question, despite the ruling of the Supreme Court. The president himself said his administration was pushing hard to find ways to add the question.

"Some in the media have been suggesting, in the hysterical mode of the day, that the administration has been planning to add the citizenship question to the census by executive fiat without regard for contrary court orders or what the Supreme Court might say," he said. Barr added, "That was never under consideration. We have always accepted that a new decision to add a citizenship question to the census would be subject to judicial review."

The census came up earlier in the day, too, during the White House "social media summit" just before the president's formal statement on the matter.

Addressing a room filled with conservative social media personalities and bloggers, the president lamented that three "very unfriendly courts" won't allow a question about citizenship to be included in the census.

"Can you believe -- are you a citizen of the United States of America? 'Sir, you can't ask that question.' Why? Because the courts said you can't. We have three very unfriendly courts. They fight us all the way. Judges don't like us too much, I guess," Mr. Trump said, perhaps referring to a federal judge in Maryland who is allowing a case which claims that the proposed question discriminated against immigrants to move forward.

"They go through houses. They ring doorbells. They talk to people. 'How many toilets do they have? How many desks do they have? How many beds? What's their roof made of?' The only thing we can't ask is, 'are you a citizen of the United States?'" Mr. Trump continued, mimicking census officials conducting interviews.

The president had been exhibiting frustration over the Supreme Court decision that blocked his administration from adding the question, ruling the government had failed to provide adequate justification for the question. Multiple legal battles over the question are still playing out in lower courts.

The administration is under a deadline to print the census, and the census questionnaire has already been sent to the printer for printing.

Paula Reid and Arden Farhi contributed reporting.