President Donald Trump on Wednesday granted a full pardon to Michael Flynn, his former national security adviser who had pleaded guilty to lying to the FBI about his contacts with the Russian ambassador.

Under Attorney General William Barr, the Department of Justice had been trying to drop the charge against Flynn. But prosecutors met stiff resistance from District Judge Emmet Sullivan, who held a hearing to explore whether the department was acting to protect a Trump associate.

“It is my Great Honor to announce that General Michael T. Flynn has been granted a Full Pardon,” Trump said on Twitter. “Congratulations to @GenFlynn and his wonderful family, I know you will now have a truly fantastic Thanksgiving!”

Kayleigh McEnany, the White House press secretary, issued a lengthy statement saying the pardon will end the “the relentless, partisan pursuit of an innocent man.”

Jerrold Nadler, the chairman of the House Judiciary Committee, called the pardon “undeserved, unprincipled, and one more stain on President Trump’s rapidly diminishing legacy.”

Flynn was prosecuted as part of Robert Mueller’s inquiry into Russian interference in the 2016 election. He pleaded guilty in December 2017 to lying to FBI agents about his conversations with Russian ambassador Sergey Kislyak during the Trump transition.

At the time of the conversations, President Barack Obama had just imposed sanctions on Russia as punishment for its efforts to help Trump’s campaign. Flynn urged the ambassador not to respond to the sanctions in kind.

When Flynn was later interviewed by FBI agents, he said he did not recall speaking to the ambassador about the sanctions. Flynn also lied to Vice President Mike Pence about his conversation, and was forced to resign after 22 days as national security adviser.

He pleaded guilty and agreed to cooperate with the Mueller probe. But he later hired Sidney Powell, the attorney recently jettisoned from Trump’s election litigation team, and repeatedly sought to withdraw his plea.

The Justice Department initially defended the prosecution, but did an abrupt about-face earlier this year, telling the judge that it no longer had confidence in the case. When Sullivan did not immediately drop the charge, Flynn’s attorneys appealed to the D.C. Circuit, hoping to get an order requiring the judge to comply with the DOJ’s wishes. The appeals court instead allowed Sullivan to proceed with a hearing into the reasons for the DOJ’s decision. Sullivan had yet to rule when the pardon was issued.

The pardon puts an end to that process, but also forces Trump to assume responsibility for Flynn’s exoneration, rather than leaving it up to the DOJ.

Trump had previously commuted the sentence of Roger Stone, the political operative who was convicted at trial of witness tampering and impeding a congressional inquiry. Stone was sentenced to 40 months, but Trump’s action kept him out of prison.

Trump has also pardoned Joe Arpaio, the Arizona sheriff who was convicted of contempt of court, and Rod Blagojevich, the former Democratic governor of Illinois who was serving a prison term for corruption, among others.