Attorney General William Barr’s wildly inappropriate campaign to spin the Mueller report in Donald Trump’s favor last year may have finally backfired. On Thursday, U.S. District Judge Reggie Walton ordered Barr to submit the full, unredacted report so he could assess whether the Department of Justice’s redactions comply with the Freedom of Information Act. Walton’s remarkable order noted that Barr’s “misleading public statements” about the report raise the possibility that his redactions are “tainted” and “self-serving”—and, by extension, illegal.

On March 24, Barr notoriously provided a “summary” of the 381-page Mueller report just two days after receiving it. He cited special counsel Robert Mueller’s report as saying that the investigation “did not establish that members of the Trump Campaign conspired or coordinated with the Russian government in its election interference activities,” leaving out the damaging first half of that sentence. Barr also wrote that he and Deputy Attorney General Rod Rosenstein had concluded “that the evidence developed during the Special Counsel’s investigation is not sufficient to establish that the President committed an obstruction-of-justice offense.” In reality, Mueller had determined that he would not offer an opinion on the matter but that the evidence gathered was not sufficient to clear Trump of obstruction of justice.

Three days after Barr released his summary, Mueller sent a letter to the attorney general stating that the summary “did not fully capture the context, nature, and substance” of the report. When members of Congress asked Barr about Mueller’s possible objections to his summary, he flatly lied. And on April 18, Barr delivered a stunningly dishonest press conference effectively announcing that the report exonerated the president.

In his Thursday order, Walton took issue with both the “summary” and the press conference. Barr’s initial summary, he wrote, “distorted the findings in the Mueller Report” in at least two ways. First, Barr “failed to indicate” that Mueller “identified multiple contacts” between the Trump campaign “and individuals with ties to the Russian government.” Second, he excluded the fact that Mueller “determined not to make a traditional prosecutorial judgment” about Trump’s alleged obstruction of justice, falsely implying that the report found no obstruction.

Walton wrote that he was “troubled” by Barr’s “hurried release of his March 24, 2019 letter well in advance of when the redacted version of the Mueller Report was ultimately made available to the public.” He questioned “whether Attorney General Barr’s intent was to create a one-sided narrative about the Mueller Report—a narrative that is clearly in some respects substantively at odds with the redacted version of the Mueller Report.” Walton simply could not “reconcile certain public representations made by Attorney General Barr with the findings in the Mueller Report.” And he feared that Barr “made a calculated attempt to influence public discourse about the Mueller Report in favor of President Trump despite certain findings in the redacted version of the Mueller Report to the contrary.”

The attorney general’s “lack of candor” and “misleading public statements,” Walton concluded, undermine his “credibility,” and the credibility of the DOJ. Walton demanded an opportunity to ensure that the redactions were not “tainted” or “self-serving.” He directed the DOJ to submit an unredacted copy of the report for him to review in chambers to ensure that each redaction truly falls into a lawful FOIA exception. “Adherence to the FOIA’s objective of keeping the American public informed of what its government is up to,” Walton concluded, “demands nothing less.”

The FOIA request at issue was submitted by the Electronic Privacy Information Center, Jason Leopold, and BuzzFeed. Given that Barr’s Justice Department will not even submit an unredacted Mueller report to the House of Representatives, it’s safe to assume the agency will appeal Walton’s ruling. But no matter the eventual outcome of this dispute, his order constitutes a rare and extraordinary judicial rebuke of the nation’s chief law enforcement officer. Barr’s crusade to frame the Mueller report as an exoneration may have muffled its impact. But the attorney general’s relentless mendacity may have undercut his efforts to protect the president by keeping many of Mueller’s findings a secret.