President Donald Trump announced Thursday that he is backing off his effort to include a citizenship question in the 2020 census and is instead issuing an executive order directing departments and agencies to better share data related to the number of citizens and noncitizens in the country.

“We have great knowledge in many of our agencies," Trump said. "We will leave no stone unturned.”

The order will eliminate "long-standing obstacles" to data sharing and allow the administration to combine that data with the information from the 2020 census questionnaire to create a more accurate count than in the past, the president said.

ABC News first reported Trump's expected announcement. The news conference came as two federal judges refused to let the Department of Justice withdraw lawyers from a lawsuit over the Trump administration's plans to put the citizenship question on the 2020 census form.

The administration is currently printing census forms without the question after the Supreme Court ruled late last month that Commerce Secretary Wilbur Ross, who stood alongside Trump during his announcement Thursday, did not provide an adequate reason for why the question was necessary.

Attorney General William Barr, who also appeared with Trump at the new conference, said the Supreme Court's decision effectively closed off the possibility of successfully litigating the issue without jeopardizing the ability to carry out the census on time.

The situation presented “a logistical impediment, not a legal one,” Barr said.

Last week, Trump told reporters on the White House South Lawn when asked if he would issue an executive order to include the question on the census: "We're thinking about doing that."

"It's one of the ways," he added. "We have four or five ways we can do it. It's one of the ways and we're thinking about doing it very seriously."

The Commerce Department already gathers information about citizenship from other government agencies. Congress now requires the Census Bureau to collect citizenship data through what's known as the American Community Survey, which samples about 2 percent of households every year. That information is combined with data the bureau gets from other agencies.

Because proof of citizenship is required to get a passport, a job or government benefits, other agencies have data that can be used to estimate citizenship, and the Census Bureau relies heavily on information from the Social Security Administration. Some state data files are consulted as well, along with military records and information from the Department of Homeland Security.

The Census Bureau had emphasized it could produce better citizenship data without adding the question to the census, recommending that it combine information from the annual American Community Survey with records held by other federal agencies.

"This would result in higher quality data produced at lower cost," Deputy Census Bureau Director Ron Jarmin wrote in a December 2017 email to a Justice Department official.

But Ross ultimately rejected that approach and ordered the citizenship question be added to the census.

Opponents of putting the question on the census form itself — the short form that goes to every household — have said that noncitizens tend not to respond, making that method of determining citizenship unreliable.

Democrats and immigrant rights groups also have argued that the real purpose of the citizenship question was to prevent immigrants from filling out the form and thus produce political gains for Republicans.

Dale Ho, director of the American Civil Liberties Union’s Voting Rights Project, who argued the Supreme Court case, said in a statement that he would continue to scrutinize Trump's new plan closely.

Ho accused Trump of wanting "to sow fear in immigrant communities and turbocharge Republican gerrymandering efforts by diluting the political influence of Latino communities."

"Now he’s backing down and taking the option that he rejected more than a year ago," Ho added. "Trump may claim victory today, but this is nothing short of a total, humiliating defeat for him and his administration."

Soon after Trump's announcement, the Justice Department said it will tell the courts it is no longer fighting the census issue.

"Today’s Executive Order represents an alternative path to collecting the best citizenship data now available, which is vital for informed policymaking and numerous other reasons," spokesperson Kerri Kupec said in a statement. "Accordingly, the Department will promptly inform the courts that the Government will not include a citizenship question on the 2020 decennial census.”

At her weekly press conference Thursday, House Speaker Nancy Pelosi announced the House will vote next week to hold Ross and Barr in criminal contempt for their role in the development of the citizenship question on the census.

On Tuesday, Sens. Brian Schatz, D-Hawaii, and Jack Reed, D-R.I., asked Ross and Barr in a letter to "immediately cease consideration of an executive order or any other means of adding a citizenship question and instead take all necessary steps to ensure an on-time Decennial Census."

"The notion that the Administration is seeking a new rationale to add a citizenship question after Chief Justice Roberts characterized its previous position as 'contrived' is deeply disturbing," the senators wrote. "It strains credulity that the Administration could come up with a new rationale that wouldn't be similarly flawed and disingenuous at this late date."

Meanwhile, the press conference came at the conclusion of another event that's drawn considerable attention in recent days, the president's planned social media summit. Trump hosted several right-wing internet personalities to "share how they have been affected by bias online" as Republicans for months have blasted social media companies for what they see as unfair censorship of their views online.

Trump went on an extended tweetstorm Thursday as he hyped the event.

"A big subject today at the White House Social Media Summit will be the tremendous dishonesty, bias, discrimination and suppression practiced by certain companies," he wrote. "We will not let them get away with it much longer. The Fake News Media will also be there, but for a limited period."