The Justice Department on Thursday dropped its prosecution of former national security advisor Michael Flynn, who had pleaded guilty to lying to FBI agents about his conversations with a Russian diplomat in the weeks before President Donald Trump's inauguration.

The bombshell move comes more than two years after Flynn's guilty plea and agreement to cooperate with the then-ongoing investigation by special counsel Robert Mueller into Russian interference in the 2016 presidential election.

But it also comes nearly a year after Flynn hired a new lawyer, Sidney Powell, who was a harsh critic of Mueller.

Powell laid the groundwork for Flynn to seek a withdrawal of his guilty plea and ultimately to challenge the legitimacy of the case on the claim that federal prosecutors had withheld potentially exculpatory material from him and his lawyers.

Previously undisclosed documents that were released in late April bolstered Powell's argument, and led to the Justice Department's decision to abandon the case.

One such document suggested that the FBI might try to "get him [Flynn] to lie" to agents during an interview.

Judge Emmet Sullivan, who presided over the case, has yet to sign off on the Justice Department's motion to dismiss the prosecution of Flynn.

The move to drop the case against the retired U.S. Army lieutenant general was approved by Attorney General William Barr on the recommendation of a top federal prosecutor whom Barr recently tasked to review the case.

In an interview with CBS News that aired Thursday evening, Barr said he and his department believed it was "our duty" to dismiss Flynn's case.

"A crime cannot be established here," Barr told CBS. "They did not have a basis for a counterintelligence investigation against Flynn at that stage."

When reminded that Flynn had admitted to lying, Barr responded: "People sometimes plead to things that turn out not to be crimes."

Barr said he wanted "to make sure that we restore confidence in this system," but added that he was "prepared" for his decision to spark a major backlash.

"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 had strongly criticized Flynn's prosecution in the past - even after Flynn twice admitted in court proceedings that he had falsely told FBI agents in January 2017 that he did not ask Russia's ambassador to the U.S to refrain from escalating sanctions in response to the imposition of sanctions against Russia by the Obama administration.

"He was an innocent man. He is a great gentleman," Trump told reporters Thursday at the White House. "Now in my book he's an even greater warrior."

Trump, who said he had not known beforehand of the decision to drop the case, said, "He was targeted by the Obama administration and he was targeted in order to try and take down a president."

"And I hope a lot of people are going to pay a big price, because they're dishonest crooked people, they're scum, and I say it a lot, they're scum, they're human scum. This should never have happened in this country," Trump said.

"They got caught. Very dishonest people, but much more than - it's treason. It's treason."

Flynn later Thursday tweeted a video of his young grandson reciting the Pledge of Allegiance, with the final words, "with liberty and justice for all."

In court documents filed in U.S. District Court in Washington, the Justice Department said it wanted to end the prosecution of Flynn after "a considered review of all the facts and circumstances of this case, including newly discovered and disclosed information."

"The Government has concluded that the interview of Mr. Flynn was untethered to, and unjustified by, the FBI's counterintelligence investigation into Mr. Flynn - a no longer justifiably predicated investigation that the FBI had, in the Bureau's own words, prepared to close because it had yielded an 'absence of any derogatory information,'" the filing said.

"The Government is not persuaded that the January 24, 2017 interview was conducted with a legitimate investigative basis and therefore does not believe Mr. Flynn's statements were material even if untrue. Moreover, we [do] not believe that the Government can prove either the relevant false statements or their materiality beyond a reasonable doubt."

Timothy Shea, U.S. attorney for the District of Columbia, said in the filing that although Flynn had pleaded guilty to making false statements, "in the Government's assessment, however, he did so without full awareness of the circumstances of the newly discovered, disclosed, or declassified information as to the FBI's investigation of him."

Those new documents cited by Shea included a handwritten note by Bill Priestap, then-FBI counterintelligence chief, dated Jan. 24, 2017, that was prepared before FBI agents questioned Flynn about his discussions with Russia's then-ambassador to the United States, Sergey Kislyak.

"What's our goal? Truth/Admission or get him to lie, so we can prosecute him or get him fired?" Priestap had written.

On the same note, Priestap had written, "If we're seen as playing games, WH will be furious. Protect our institution by not playing games."

Flynn's lawyer Powell did not immediately respond to a request for comment about the dismissal of the case.

The documents unsealed in Flynn's case last month were shared with Powell and Flynn's other lawyers after Barr appointed the U.S. attorney for the Eastern District of Missouri, Jeffrey Jensen, to review the case.

Jensen, in a statement, said, "Through the course of my review of General Flynn's case, I concluded the proper and just course was to dismiss the case. I briefed Attorney General Barr on my findings, advised him on these conclusions, and he agreed."

James Comey, who was FBI director at the time that Flynn lied to agents, on Twitter wrote that the Department of Justice "has lost its way," but urged career staff at the DOJ to stay in the department "because America needs you."

"The country is hungry for honest, competent leadership," Comey wrote.

Former FBI Deputy Director Andrew McCabe said in a statement: "The Department's position that the FBI had no reason to interview Mr. Flynn pursuant to its counterintelligence investigation is patently false, and ignores the considerable national security risk his contacts raised. Moreover, the Department's position contradicts the findings by both the Special Counsel and the Office of the Inspector General."

"Today's move by the Justice Department has nothing to do with the facts or the law- it is pure politics designed to please the president," McCabe said.

McCabe also said that the FBI had opened its Russia investigation "to determine if the Russian government coordinated with the Trump campaign." He noted that Flynn "had prominent, high level interactions with Russian officials, so we investigated whether he might be that point of coordination."

"We received incontrovertible evidence that Mr. Flynn spoke to the Russian ambassador on more than one occasion, that he actively tried to influence the actions of Russian officials, and that those officials acceded to his requests," McCabe said.

"The FBI was obligated to interview him to better understand why he was talking to Russian officials. During the interview, he lied about the substance of his conversations with those officials. His lies added to our concerns about his relationship with the Russian government. Later, under oath in Federal Court, he twice admitted to lying to the FBI."

But Trump's son, Donald Trump Jr., in a tweet wrote that he hoped that Flynn "sues the s--- out of those clowns at the FBI who put him through that nonsense for three years setting him up and flagrantly sitting on all of the exculpatory evidence for 3 years. I truly hope they don't get away with this travesty of justice."

Shortly before the news broke about the dismissal, a top prosecutor in Flynn's case withdrew from that case, according to a filing in federal court.

Flynn had spent just a handful of weeks as Trump's national security advisor. He resigned after admitting to lying to Vice President Mike Pence about the nature of his talks with Kislyak.

Flynn's criminal sentencing had been repeatedly postponed.

The advocacy group Citizens for Responsibility and Ethics in Washington said in a prepared statement, "Attorney General Barr has consistently acted for the personal and political benefit of President Trump, rather than fulfilling his duty as chief law enforcement officer of the United States, and has even meddled in prosecutions to help the president's friends and allies."

"Today's dismissal of the case against former National Security Advisor Michael Flynn, previously affirmed by prosecutors, the presiding judge, and a guilty plea from Flynn himself, needs to be seen through that lens," said CREW Executive Director Noah Bookbinder.

"We have to be deeply skeptical that this is anything other than a further capturing of our criminal justice system for the benefit of the president," Bookbinder said. " The president doesn't need to issue pardons to his cronies when his attorney general appears willing to terminate their cases before justice can be served."

tag