Michael Flynn’s lawyer asked President Trump not to pardon his former national security adviser and personally briefed the president on the case this month, the attorney told a judge reviewing the Justice Department’s bid to dismiss the prosecution Tuesday.

The disclosure by Flynn’s attorney Sidney Powell was one of the most striking notes of a contentious five-hour hearing before U.S. District Judge Emmet G. Sullivan into whether the court should grant a Justice Department request to dismiss the case.

Flynn was the highest-ranking Trump adviser charged in special counsel Robert S. Mueller III’s Russia investigation and pleaded guilty in 2017 to lying about his dealings with a Russian diplomat. As he awaited sentencing, though, Flynn changed legal teams and tried to undo his plea, and his effort soon gained an unlikely ally: Attorney General William P. Barr, who tapped a prosecutor to specially review the matter and then had the Justice Department move to walk away.

The request sparked outcry from those who felt the country’s top law enforcement official was inappropriately intervening in a criminal case to help a friend of the president. Trump has repeatedly alleged that Flynn was wronged, and Powell’s revelation Tuesday seemed to reinforce the president’s personal interest in the case.

Throughout the hearing, Sullivan emphasized that his role is not to serve as a “rubber stamp” in reviewing the Justice Department request.

The Justice Department rejected assertions that it had abandoned the case for corrupt, political reasons.

The decision “was the right call for the right reasons,” argued Kenneth C. Kohl, a veteran career prosecutor in the U.S. attorney’s office in Washington. “Career prosecutors looking at these facts would not have brought this case.”

The hearing follows an 8-to-2 decision from the full U.S. Court of Appeals for the D.C. Circuit in August that denied Flynn’s request, backed by the Justice Department, to shut down Sullivan’s planned review. The court’s order also directed Sullivan to act “with appropriate dispatch.”

The climactic confrontation could help define the limits of executive- and judicial-branch powers and comes weeks before an election in which Flynn’s contentious prosecution has electrified Trump’s supporters and opponents.

Flynn, 61, has been awaiting sentencing since pleading guilty nearly three years ago to lying about his contacts with Russia’s ambassador after Moscow intervened to support Trump in the 2016 U.S. election.

Trump and his allies have made Flynn’s cause a focus of efforts to discredit the criminal inquiry into whether individuals associated with Trump’s campaign cooperated with Russia’s illegal assistance. The efforts include government disclosures that have drawn fresh scrutiny to the judgment of FBI agents and Mueller prosecutors but have not undercut findings that the FBI had a legal basis to open the wider investigation.

The Justice Department in May moved to drop Flynn’s guilty plea. The department based the reversal on Barr’s conclusion from a review he ordered that Flynn’s interview by the FBI “was unjustified” and so his lies were immaterial to any crime.

Law enforcement officials and Democratic critics condemned the turnabout, accusing Barr of undermining the department and protecting the president, citing the drive to exonerate Flynn and soften the sentencing of Trump’s friend Roger Stone for lying to investigators in a House Russia probe.

Tuesday’s hearing further detailed the government’s reasoning and highlighted the relationship between Flynn and the Trump administration.

Flynn’s lawyer initially declined to answer Sullivan’s questions about her interactions with Trump, citing executive privilege. Powell later relented after the judge noted she was not a government official.

In a text message after the hearing, Powell explained the request to the president, saying, “General Flynn is entitled to a public exoneration by the court. If the system works right, the wrongful prosecution will be dismissed with prejudice. No pardon should be needed. General Flynn is innocent.”

The White House had no comment Tuesday.

Sullivan pressed the government about the possible influence of Trump’s tweets criticizing Flynn’s prosecution.

“I am authorized to represent to you that the Attorney General’s decisions in this case were not based on communications with the president or the White House, and they’re not based on any of the tweets or other things you reference,” Justice Department lawyer Hashim Mooppan said.

Even so, Kohl added that Trump’s tweeting “makes our job harder, too.”

But, he insisted, the government’s change of heart was based on credibility problems with likely witnesses against Flynn if prosecutors had to prove their case in court. Kohl pointed to a recent interview investigators conducted with veteran FBI agent William Barnett, who was assigned to the Flynn case and the office of special counsel, and criticized what he called a “get Trump” attitude by some on the team.

Sullivan said he would issue a ruling in writing “with dispatch.” The decision could turn on whether a federal rule that allows U.S. prosecutors to dismiss a prosecution with “leave of court” means that judges can refuse if they believe it is in the public interest. Sullivan appointed former New York federal judge John Gleeson to argue against the government to preserve an adversarial proceeding.

Gleeson urged Sullivan to deny the motion, calling it “a gross abuse of prosecutorial power.” He disputed the government’s explanation for its reversal and noted Trump has tweeted or retweeted more than 100 times about Flynn’s case.

The government moved to close the case, Gleeson said, because the president “wants Flynn off the hook, and doesn’t want to use the pardon power to do it.”

Gleeson warned about the possible damage to the reputation of the court and the Justice Department.

The government, he said, has “created rules that apply to Flynn and no one else, and wants the court to apply those rules.” It was a travesty that “this could happen in a nation committed to the rule of law, and Judge Sullivan, you should not allow that to happen,” Gleeson concluded.

Sullivan sounded skeptical of the Justice Department’s assertion that Flynn’s lies were irrelevant because they were not connected to another crime. The judge said it is never a defense to lying to say that “the government was not actually deceived,” or to argue that prosecutors cannot investigate a subject who lies.

Mooppan told Sullivan the government was “not suggesting that this court is a rubber stamp, or that the court has no role to play whatsoever” in cases of corrupt acts by individual prosecutors. But he said the court should not “second guess the executive branch’s authoritative position.”

Powell in her arguments cited disclosures from a Barr-ordered review of FBI and Justice Department communications about the handling of Flynn’s case. She called Flynn’s prosecution a “politically corrupt effort to ‘get Trump’ and to ‘get general Flynn’, ” likening it to “a potential coup.”

Sullivan responded that Flynn earlier expressed remorse before the judge.

“Well when he was before me he plead guilty, he said he was guilty,” Sullivan said.

The hearing was held remotely Tuesday via video and telephone conference because of the coronavirus pandemic. The proceedings were interrupted for a stretch because of technical problems.

Flynn cooperated with the Mueller probe, and leniency was initially recommended at sentencing. But he switched course after Mueller’s investigation, accusing prosecutors and his former defense attorneys of concealing FBI misconduct and coercing him into pleading guilty.

The department rejected those claims through the past year, and Sullivan ruled Flynn was relying on bogus theories to deny Mueller’s central finding of Russian interference and to wriggle out of his repeated sworn admissions of misconduct.

But after Barr launched a review of the case, the department cited recently uncovered FBI records including communications showing the bureau had decided to close a counterintelligence investigation of Flynn — dubbed Crossfire Razor — before learning of his December 2016 calls with then-Ambassador Sergey Kislyak. The Justice Department also said the FBI knew from transcripts that the calls probably did not give rise to a crime by themselves and FBI officials differed over how to handle or interpret his actions.

In response, more than 1,100 former prosecutors said in a friend-of-the-court brief that the Justice Department distorted facts and appeared to have been bent to serve the president’s will.

Flynn faces a sentence of zero to six months under his initial plea deal.

Seung Min Kim contributed to this report.