A retired federal judge appointed to oppose the Justice Department’s bid to dismiss former national security adviser Michael Flynn’s guilty plea to lying to the FBI requested on Monday a hearing for oral arguments after he briefs the court.

The request for a hearing sets the stage for a pitched legal and political battle triggered by Attorney General William P. Barr’s April 30 move to undo the conviction of the highest-ranking adviser to President Trump convicted in special counsel Robert S. Mueller III’s Russia investigation.

U.S. District Judge Emmet G. Sullivan last week paused the case to hear from outside groups and appointed former New York federal judge John Gleeson to argue against the Justice Department request to undo Flynn’s charges. Sullivan also asked Gleeson to examine whether the former three-star general may have committed perjury.

Trump supporters and some conservative legal analysts have cheered Barr’s conclusion that the president’s former national security adviser should never have been interviewed by the FBI in January 2017 and that therefore his lies concealing his Russian contacts were immaterial to any crime. Flynn pleaded guilty that December to concealing his talks about U.S. sanctions with Russia’s ambassador to the United States.

But the department has been badly split — and many legal experts have been outraged — as insiders and thousands of Justice Department alumni claim that the institution is being politicized and bent to Trump’s will.

The struggle is marked by legal and political arguments over Sullivan’s authority to stop prosecutors and the defense from jointly moving to reverse a conviction. It has also set off a debate over whether Barr’s move is compromising the integrity of the department and courts and whether Trump should pardon his former aide instead of pushing a court to reluctantly sign off on his exoneration.

Gleeson on Monday proposed that the judge allow the government and outside groups to respond after he files his argument in three weeks. Also Monday, in one of the first publicly released draft filings to advise the court, more than 960 former Justice Department prosecutors accused Barr of appearing to serve the president’s personal political interests. The prosecutors, whose service dates to President Dwight D. Eisenhower’s administration, said in the filing that Barr violated his oath to faithfully execute the law and helped Trump undermine the Constitution by giving an aide impunity to lie to government investigators.

In a 34-page friend-of-the-court brief organized by attorneys with the nonpartisan, nonprofit group Protect Democracy and Harvard Law School professor Andrew Manuel Crespo, former prosecutors argued that Supreme Court precedent gives Sullivan authority to undertake “a searching review” of Flynn’s case and to “protect the public interest in the evenhanded enforcement of our laws.”

“Our democracy is safe only when the enormous power of federal law enforcement is applied equally to all citizens based on facts and the law, rather than the political whims of a particular president,” the group wrote. “President Trump and Attorney General Barr have flouted these principles by seeking to dismiss the prosecution of Michael Flynn for what appear to be partisan political reasons.”

The group said the FBI had indisputably legitimate grounds to investigate Flynn’s lies. The government previously said ­Flynn’s lies went to the heart of the investigation of whether Trump’s campaign coordinated with Russia’s intervention in the 2016 U.S. election, whether Flynn was seeking to reward Russia at Trump’s direction or others’, and whether his lies exposed Flynn to Russian blackmail.

Federal law criminalizes lying in any matter under court, congressional or executive branch jurisdiction, the group said. The FBI has a dual mission to investigate crimes as well as national security threats that may not be criminal, the group also argued.

A Justice Department reading of the law that only lies by people under an open, valid investigation can be charged “could well call into question myriad past and future prosecutions,” since investigators now can and often do open investigations once a subject lies, or lies to try to avert one, the filing asserted.

Flynn pleaded guilty to lying in an FBI interview on Jan. 24, 2017, four days after taking office, regarding conversations with Russia’s ambassador about not escalating hostilities over new U.S. sanctions and other late Obama administration policies ahead of Trump taking office.

In its April 30 motion to abandon Flynn’s prosecution, the Justice Department cited recently uncovered FBI records showing the bureau had decided to close a counterintelligence investigation of Flynn 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 that FBI officials differed over how to handle or interpret his actions.

Citing “frail and shifting justifications for its ongoing probe,” the FBI’s irregular moves to question him and earlier abuses in surveillance applications, the government concluded that Flynn’s interview “was untethered to, and unjustified by the FBI’s counterintelligence investigation” and that it was “conducted without any legitimate investigative basis.”

Some Justice Department veterans and many conservative commentators have assailed Sullivan’s actions as an overreach given the department’s judgment. Brett Tolman, former U.S. attorney for Utah, called the judge’s actions “outrageous” in a Fox News interview, citing the deference that courts have said judges usually should give prosecutors in dismissal motions.

In 2016, the U.S. Court of Appeals for the D.C. Circuit wrote that while the government may dismiss charges only “with leave of court,” the judiciary “generally lacks authority to second-guess” executive branch decisions, and such judgments “lie squarely within the ken of prosecutorial discretion.”

Separately on Monday, 15 Republican state attorneys, led by Ohio Attorney General Dave Yost, called on Sullivan to dismiss ­Flynn’s case immediately without commentary, saying that “such punditry disrobes the judiciary of its cloak of impartiality.”

“The federal judiciary has no authority to make the executive branch pursue (or continue to pursue) a criminal conviction,” the GOP officials wrote in another friend-of-the-court brief, adding, “The decision to charge a crime is a critically important function, deliberately left to the executive branch alone.”

Others legal scholars disagree, however, and say the D.C. court and other federal appeals courts give judges authority to hold hearings, hear evidence and guard against dubious dismissals that benefit powerful and well-connected defendants without basis in fact, in bad faith and against the public interest.

Carol D. Leonnig contributed to this report.