A federal judge can scrutinize the Justice Department’s decision to drop the criminal case against President Trump’s former national security adviser Michael Flynn, a federal appeals court in Washington ruled Monday, allowing the legal saga to continue.

The decision from the full U.S. Court of Appeals for the D.C. Circuit allows U.S. District Judge Emmet G. Sullivan to question prosecutors’ unusual move to dismiss Flynn’s case ahead of sentencing. The retired general twice pleaded guilty to lying to the FBI about his Russian contacts before Trump took office in 2017.

In an 8-to-2 ruling, the court denied Flynn’s request, backed by the Justice Department, to shut down Sullivan’s planned review and his appointment of a retired federal judge to argue against the government’s position.

The decision by the full court reverses a ruling by a three-judge panel of the same court that ordered Sullivan to immediately close the case.

Judge Thomas Griffith said it would be premature for the appeals court to force Sullivan’s hand before he had rendered a decision.

“Today we reach the unexceptional yet important conclusion that a court of appeals should stay its hand and allow the district court to finish its work rather than hear a challenge to a decision not yet made,” Griffith wrote in a statement concurring with the court’s unsigned opinion. “That is a policy the federal courts have followed since the beginning of the Republic.”

The court also rejected Flynn’s attempt to have his case reassigned to a different judge, finding “no basis for disqualifying” Sullivan.

Judges Karen LeCraft Henderson and Neomi Rao, who sided with Flynn in the initial panel’s decision, dissented.

Henderson called for Sullivan’s removal from the case and said he had compromised his impartiality “beyond repair” by seeking review of the panel’s decision by the full court and hiring a lawyer to represent him before the D.C. Circuit.

In a tweet Monday, Flynn’s attorney Sidney Powell said the court’s decision is a “disturbing blow” to the rule of law.

In May, Sullivan refused to immediately go along with the Justice Department’s request to toss the case. Instead, he tapped John Gleeson, a retired New York federal judge, to oppose the Justice Department.

Sullivan’s move prompted Flynn’s legal team to petition the D.C. Circuit to get involved midstream and cut off the judge’s review. Sullivan hired his own attorney, Beth Wilkinson, to defend the court’s authority to investigate whether dismissing the case is in the public interest.

The extraordinary legal battle has raised unsettled questions about the power of the courts to check the executive branch. Prosecutors must get permission from the presiding judge to drop charges against a criminal defendant. Legal experts, however, disagree about the limits of Sullivan’s authority, and in practice, judges typically defer to prosecutors.

But there is nothing typical about this case.

Flynn was the highest-level Trump adviser convicted in special counsel Robert S. Mueller III’s Russia investigation. Instead of proceeding to sentencing, Attorney General William P. Barr ordered a review of the investigation into Flynn and his dealings with the Russian ambassador to the United States. Barr then moved to drop the long-running case, saying new evidence showed that FBI agents did not have a valid reason to question Flynn, so any lies he told did not amount to a crime.

Flynn’s attorneys told the appeals court that Sullivan had no discretion to continue the case once the government decided to drop it. They also asked the court to reassign the case, accusing Sullivan of bias in his choice of Gleeson to argue the other side.

In her dissent, Henderson criticized Sullivan for obtaining a lawyer, saying it added to the appearance that he views himself as a party in the case.

“If there was any doubt up to this point whether his conduct gives the appearance of partiality, that doubt is gone,” Henderson wrote.

But the court majority backed Sullivan, saying the judge had participated in the appeal at the D.C. Circuit’s invitation. Nothing in Sullivan’s filing, the court said, “indicates bias in connection with the underlying criminal case. Indeed, any views the District Judge has conveyed in his briefing before us come from what he has learned in carrying out his judicial responsibilities.”

During oral arguments, Jeffrey B. Wall, the acting solicitor general, also urged the court to block the judge’s review, saying Sullivan has no authority to dig into the administration’s motives.

Trump and his supporters have rallied behind Barr’s intervention and Flynn’s effort to undo his guilty plea. Supporters say Flynn never should have been interviewed by the FBI. But scores of former and current Justice Department employees say the saga is a troubling example of the department bending to political pressure and the president’s ­interests.In high-profile political cases, “the party affiliation of the President who appoints a judge becomes an explanation for the judge’s real reason for the disposition, and the legal reasoning employed is seen as a cover for the exercise of raw political power,” he wrote. “No doubt there will be some who will describe the court’s decision today in such terms, but they would be mistaken.”

The D.C. Circuit ruling came on Griffith’s final day as a judge. Griffith, a nominee of George W. Bush who announced his retirement in March, used his parting statement to emphasize the independence of the judiciary.