A federal judge on Wednesday accepted a White House statement as rescinding President Trump’s tweets that called for the “total Declassification” of all documents in the government’s investigation of Russia’s intervention in the 2016 U.S. election.

But U.S. District Judge Reggie B. Walton in D.C. chided the president for his carelessness, saying the commander in chief’s words caused confusion on a matter of national security.

“It is unfortunate that we are in this situation because, obviously, whenever there’s a reference to the declassification of classified information, the words spoken should be artfully spoken so there’s no ambiguity as to what the intention was,” Walton said. “Obviously that’s not what occurred here.”

Walton ruled in open-records lawsuits brought by news organizations and a watchdog group seeking fuller release of materials related to special counsel Robert S. Mueller III’s investigation.

The groups sought an emergency review of material withheld by the government after Trump tweeted on Oct. 6: “I have fully authorized the total Declassification of any & all documents pertaining to the single greatest political CRIME in American History, the Russia Hoax. Likewise, the Hillary Clinton Email Scandal. No redactions!”

Justice Department attorneys last week argued to the judge that the White House Counsel’s Office notified the department that despite Trump’s statement, “There is no order requiring wholesale declassification or disclosure of documents at issue.”

Walton — a 2001 appointee of George W. Bush and former presiding judge of the U.S. Foreign Intelligence Surveillance Court — rejected that explanation, directing the department to produce a declaration from a person who had conferred directly with the president.

“I think the American public has a right to rely on what the president says his intention is,” Walton said Friday.

“It seems to me when a president makes a clear, unambiguous statement of what his intention is, that I can’t rely on the White House Counsel’s Office saying, ‘Well, that was not his intent,’ ” he added.

In a court filing Tuesday, White House Chief of Staff Mark Meadows declared that Trump did not mean what his tweet said.

“The President indicated to me that his statements on Twitter were not self-executing declassification orders and do not require the declassification or release of any particular documents,” Meadows said.

He added, “Instead, the President’s statements related to the authorization he had provided the Attorney General to declassify documents as part of his ongoing review of intelligence activities relating to the 2016 Presidential election and certain related matters.”

In a teleconference hearing Wednesday, Justice Department trial lawyer Courtney D. Enlow said the May 23, 2019, authorization was not an order but a delegation of discretionary authority to Attorney General William P. Barr as he conducted the review into Trump’s claims that he was improperly spied on by Obama administration appointees.

“It simply refers again to the fact that the attorney general, quote ‘may’ declassify information — not that is directed to, not that he has to, not that he’s ordered to,” Enlow said.

Walton balked at that explanation,

“I think it’s obvious the most recent statements by the president clearly could be construed as relating to something other than the prior authorization,” Walton said.

Still, the judge said that even if Trump intended otherwise, “the president has the authority to rescind that. And while he does not say that in so many words, it seems to me essentially that is what he has done.”

Walton concluded, “While it’s unfortunate the words were spoken the way they were spoken, I think I am constrained to conclude there was no further expansion, and therefore there is no need for further review of the documents.”

The ruling came in a Freedom of Information Act lawsuit filed by BuzzFeed, CNN and the Electronic Privacy Information Center in their effort to obtain Mueller-probe documents.

“We appreciate the court’s consideration and accept for today the conclusion that the president has walked back the statement,” said Charles D. Tobin, an attorney representing CNN.