The Justice Department’s decision to drop its prosecution of former national security adviser Michael Flynn on Thursday was greeted as a triumph by President Trump and his allies, who have argued for years that Flynn was set up — but with dire alarm by Trump’s opponents, who saw the move as an attack on the rule of law.

The extreme division mirrored three years of partisan combat over how the FBI handled Russian interference in the 2016 U.S. presidential election, an investigation that shadowed much of Trump’s time in office.

And the circumstances of the development — delivered by a loyalist attorney general after a key prosecutor withdrew from a case in which Flynn had previously acknowledged guilt on multiple occasions — appeared only to harden positions.

At a celebratory White House, aides cheered Attorney General William P. Barr, whose decision to appoint a new prosecutor to review the case paved the way for Thursday’s move.

Barr was largely credited with “shepherding the recommendation” and staying engaged on the Flynn case and matters related to the Russia probe, according to one White House official, who spoke on the condition of anonymity to describe internal reaction.

Trump advisers are discussing deploying the Flynn case as a weapon against putative Democratic nominee and former vice president Joe Biden this fall — and also are contemplating a possible visit to the White House by Flynn in the coming weeks, according to people familiar with the discussions.

The White House declined to comment on whether the president would be making an appearance soon with Flynn.

Trump — who forced out his national security adviser in early 2017 because the president said Flynn had lied about his interactions with the Russian ambassador to the United States — showered Flynn with praise Thursday, calling him “an innocent man.”

“Things are falling out now and coming in line showing what a hoax this whole investigation was,” he told reporters. “It was a total disgrace, and I wouldn’t be surprised if you see a lot of things happen over the next number of weeks. This is just one piece of a very dishonest puzzle.”

Congressional Democrats said they were appalled.

“With no legitimate prosecutorial basis, they’ve simply thrown away a conviction,” Sen. Richard Blumenthal (Conn.), a member of the Judiciary Committee and a former U.S. attorney and state attorney general, said in an interview. “It’s sad and outrageous for the justice system to be used in this way, for naked political ends and a coverup — and they’re obviously exploiting the pandemic as a means to distract from this.”

Democrats, Blumenthal said, “should use every platform and bully pulpit we have to fight this.”

House Judiciary Committee Chairman Jerrold Nadler (D-N.Y.) said Americans should be “furious” with a move he said was the act of a “politicized and thoroughly corrupt” Justice Department. He called for the decision to be investigated by Justice Department’s inspector general.

And a chorus of former federal prosecutors and FBI officials decried the move, saying the Justice Department had caved to years of pressure from Trump and provided Flynn an outcome he would not have received were he an ordinary defendant.

Barr — who has repeatedly expressed skepticism about the Russia investigation — said in an interview with CBS that it was the Justice Department’s “duty” to dismiss the case because prosecutors could not establish that a crime had been committed.

He disputed that he was doing Trump’s bidding — “No, I’m doing the law’s bidding,” he retorted — and said he was ready to take criticism for the decision.

“I’m prepared for that, but I also think it’s sad that nowadays, these partisan feelings are so strong that people have lost any sense of justice,” Barr said.

Trump ousted Flynn after the retired general served only 23 days as national security adviser, saying Flynn had lied to Vice President Pence and others about his conversations with the Russian ambassador in the weeks before Trump took office.

During the calls, Flynn urged Russia not to respond to sanctions imposed by the Obama administration for the Kremlin’s interference in the 2016 campaign, according to special counsel Robert S. Mueller III’s report.

Flynn pleaded guilty in December 2017 to lying to FBI agents during an interview in January of that year about the phone calls with the ambassador. He agreed to cooperate with Mueller’s team as it investigated Russia’s actions in the presidential campaign.

After Flynn pleaded guilty, Trump tweeted that he “had to fire General Flynn because he lied to the Vice President and the FBI,” adding that Flynn’s lies were a “shame” because he had done nothing illegal during the transition.

However, after Mueller concluded his work and issued his report last year, Flynn replaced his legal team and then sought to withdraw his plea, arguing that his FBI interview had been a setup designed to catch him in a lie and that he had not intended to be untruthful.

A 20-page court filing from the Department of Justice on Thursday essentially endorsed those views, arguing that the FBI had no justifiable reason to interview Flynn and would not be able to prove in court that he had made false statements.

The filing was signed by U.S. Attorney for the District of Columbia Timothy Shea, but in a statement, another prosecutor, appointed by Barr in January to review the Flynn matter, said the move had been his recommendation.

The decision came without the blessing of officials who had originally decided to investigate and then prosecute Flynn. FBI Director James B. Comey and his deputy Andrew McCabe, who had directed Flynn’s interview, were both ousted by Trump. In statements and tweets, they both blasted the decision.

“This is simply a pardon by another name. A black day in DOJ history,” tweeted Michael Bromwich, a former federal prosecutor and inspector general at Justice who now represents McCabe.

Through a representative, Mueller declined to comment. But the final member of Mueller’s team who had remained involved with the Flynn case, Brandon Van Grack, withdrew from the case Thursday just before the filing was entered.

Current and former national security officials said they were dismayed by the Justice Department’s reasoning, which seemed to argue that it was improper to question Flynn about his contacts with the Russian ambassador as part of the FBI investigation into possible cooperation between Russia and the Trump campaign.

New documents filed in the case show the FBI had been preparing to close its counterintelligence investigation into Flynn as it caught wind of his calls with Russian Ambassador Sergey Kislyak, having found no derogatory information about him after several months of work.

Flynn had been a senior campaign adviser for Trump and had traveled to Russia in 2015 at the behest of a Russian state-run media organization, facts that the Justice Department noted in its motion to withdraw the charges.

“There’s no question that predication existed” for the FBI to talk to Flynn, said Susan Hennessey, a former attorney for the National Security Agency and the executive editor of Lawfare. “I think this brief makes selective arguments as though they represent the totality of conditions, in order to make completely reasonable, fully supported investigative decisions seem as if they were illegitimate or even unlawful.”

And national security experts who think Russia was never held accountable for its role in disrupting the 2016 election said they fear the Kremlin would be pleased.

“Russia will see this as a huge victory. A sign both of American weakness and of a corrupt judicial system, in which they can continue meddling in our affairs and get away with it,” said Marc Polymeropoulos, a former CIA officer who oversaw operations in Europe and Russia at the time of the 2016 U.S. campaign.

On Thursday, Trump spoke to Russian President Vladimir Putin, afterward telling reporters that he had discussed with Putin how “the Russia hoax” had damaged his ability to work with Moscow.

“They’re a very powerful nation. Why would we not be dealing with each other? But the Russia hoax, this absolute dishonest hoax, made it very difficult for our nation and their nation to deal,” Trump told reporters.

The end of the Flynn prosecution provided Trump a resounding final victory over the Mueller investigation, which consumed nearly two years of his presidency but ended last year with a finding that the evidence did not establish that Trump’s campaign conspired with Russia in 2016.

Likewise, despite compiling a lengthy, damaging narrative of Trump’s efforts to derail the probe, Mueller declined to offer a finding as to whether Trump had engaged in obstruction of justice. In the end, Trump emerged from the investigation essentially unscathed. Mueller disbanded his office in June.

Then, in a 434-page report last year, the Justice Department’s inspector general found that the FBI’s investigation had not been driven by political bias but also concluded that there were serious flaws in the surveillance of Trump aide Carter Page, who was investigated in 2016 but never charged.

Also last year, Barr intervened to reduce the sentencing recommendation issued by career officials who had prosecuted Trump confidant Roger Stone, who was convicted of lying to Congress, obstructing an official proceeding and witness tampering, prompting the withdrawal of all four prosecutors who had overseen the case.

Stone was ultimately sentenced to 40 months in prison. He is appealing his conviction. As with Flynn, Trump has repeatedly bemoaned Stone’s prosecution and insisted that he has been treated unfairly.

Across the right wing of the Republican Party, the Justice Department’s recommendation was embraced as validation of their own views of the Russia probe, with many allies of the president’s casting the prosecution of Flynn as an example of an attempted “coup” by the “deep state” and allies of the Democratic Party and former president Barack Obama.

In a tweet, Sen. Charles E. Grassley (R-Iowa), who serves on the Senate Judiciary Committee, noted the Flynn and Page findings, and added, “Someone remind me [why] we needed $30M+ Mueller collusion investigation?”

Sen. John Cornyn (R-Tex.), a top ally of Senate Majority Leader Mitch McConnell (R-Ky.), said the recommendation “reminds me of a haunting question by ex-Labor Secretary Raymond Donovan, who after his acquittal in a 1987 fraud trial, asked, ‘Which office do I go to get my reputation back?’ ”

Sen. Mike Lee (R-Utah), who is influential in conservative legal circles, tweeted, “What happened to Gen. Flynn was a travesty.” And Sen. Marsha Blackburn (R-Tenn.) called Flynn “the victim of a plot hatched at the highest levels of the FBI to take down” Trump.

Flynn’s lawyer Sidney Powell indicated that the Justice Department’s decision was not the end of the matter, calling it “the first step toward restoring the importance of truth and the rule of law.”

Republicans signaled that they intended to continue to press what they see as their advantage on the Russia issue, particularly as Trump’s campaign against Biden heats up.

Two White House officials and an outside Trump adviser said Thursday afternoon that the campaign was considering using the Flynn case to argue that Biden and Obama should be blamed for what the White House sees as an unjust conspiracy against the president.

Hours later, the Trump campaign put out a statement saying that “a corrupt witch hunt” against Flynn had taken place “on Vice President Joe Biden’s watch.” And the president’s son, Donald Trump Jr., on Twitter called for revenge against officials who had been involved in the investigation.

“It’s time for some transparency & bad actors should be punished accordingly, you know, they way they would have punished us!” he wrote.

Correction: An earlier version of this article incorrectly referred to Sen. Charles E. Grassley (R-Iowa) as the chairman of the Senate Judiciary Committee. The committee is currently chaired by Sen. Lindsey Graham (R- S.C.) The story also has been updated with the correct date of Michael Flynn’s guilty plea.

Matt Zapotosky contributed to this report.