A federal appeals court on Wednesday ordered a lower court to allow the case against former National Security Adviser Michael Flynn to be dismissed, as requested by the Justice Department -- likely ending the years-long legal saga stemming from the Russia investigation.

The abrupt ending came in a 2-1 ruling and order from judges on the U.S. Court of Appeals for the District of Columbia.

READ: COURT'S OPINION ORDERING FLYNN CASE DISMISSAL

This was the result of an appeal from Flynn's lawyers asking for a so-called writ of mandamus -- essentially an order telling a government official to carry out a certain duty -- directing District Judge Emmet Sullivan to approve the DOJ's motion to dismiss.

Sullivan did not immediately grant that motion and instead sought to hold hearings on the matter, angering Flynn allies.

The unusual move from Sullivan to keep the case alive despite prosecutors' wishes was preceded by an unusual move from the DOJ itself to drop the charges against Flynn even after he had pleaded guilty -- saying the FBI interview that led to his charge of lying to investigators about his contacts with Russia's ambassador had no "legitimate investigative basis."

It's unclear whether Sullivan could try to appeal to the full appeals court or even to the Supreme Court in order to keep the case alive. The next step otherwise would likely be for Sullivan to comply.

Wednesday's court order was direct, ordering "that Flynn’s petition for a writ of mandamus be granted in part; the District Court is directed to grant the government’s ... motion to dismiss; and the District Court’s order appointing an amicus is hereby vacated as moot, in accordance with the opinion of the court filed herein this date."

DOJ DROPS CASE AGAINST MICHAEL FLYNN

Flynn dialed into Rush Limbaugh's radio show Wednesday, breaking his silence on the case, and calling the decision a “good thing” for him and his family, but “a great boost of confidence” for the American people and “our justice system," while touting his lawyer Sidney Powell as a “terrific lawyer” and “the American guardian of justice.”

President Trump cheered the decision Wednesday morning, tweeting: "Great! Appeals Court Upholds Justice Departments Request To Drop Criminal Case Against General Michael Flynn!"

JUDGES APPEAR SKEPTICAL OF DOJ MOVE TO DISMISS CASE, AS HIS LAWYER ALLEGES 'GOVERNMENT MISCONDUCT'

A senior DOJ official told Fox News the department is “pleased” by the appeals court decision in the Flynn case.

The accompanying decision essentially backed federal prosecutors in their move to drop the case.

”In this case, the district court’s actions will result in specific harms to the exercise of the Executive Branch’s exclusive prosecutorial power. The contemplated proceedings would likely require the Executive to reveal the internal deliberative process behind its exercise of prosecutorial discretion, interfering with the Article II charging authority,” Judge Neomi Rao, a Trump appointee, wrote in the decision.

Judge Robert Wilkins, dissenting, wrote: “It is a great irony that, in finding the District Court to have exceeded its jurisdiction, this Court so grievously oversteps its own. This appears to be the first time that we have issued a writ of mandamus to compel a district court to rule in a particular manner on a motion without first giving the lower court a reasonable opportunity to issue its own ruling."

FLYNN-KISLYAK CALL TRANSCRIPTS RELEASED, REVEALING FATEFUL TALKS OVER RUSSIA SANCTIONS

Of the DOJ's move to abandon the case, he added, "This is no mere about-face; it is more akin to turning around an aircraft carrier."

Democrats, meanwhile, have slammed the DOJ decision and cited it as an example of the department becoming politicized under Attorney General Bill Barr.

The Justice Department last month made the stunning move to drop its case against Flynn "after a considered review of all the facts and circumstances of this case, including newly discovered and disclosed information," as the department put it.

DOJ officials said they concluded that Flynn's interview by the FBI was "untethered to, and unjustified by, the FBI's counterintelligence investigation into Mr. Flynn" and that the interview was "conducted without any legitimate investigative basis," while arguing that Flynn's statements were not "material, even if untrue."

The motion to dismiss came after unsealed FBI notes revealed that there had been a question regarding what the purpose of Flynn’s interview was: whether the aim was to find out the truth or to get him to lie and thus subject him to being prosecuted or fired. Flynn ended up facing charges and being terminated from his role as national security adviser.

The handwritten notes – which the FBI's former head of counterintelligence Bill Priestap penned after a meeting with then-FBI Director James Comey and then-FBI Deputy Director Andrew McCabe – showed officials discussing the fateful January 2017 interview in advance. They apparently discussed various options, including getting Flynn "to admit to breaking the Logan Act" when he spoke to former Russian Ambassador Sergey Kislyak during the presidential transition period.

"What is our goal?" one of the notes read. "Truth/Admission or to get him to lie, so we can prosecute him or get him fired?"

Another note read, "If we get him to admit to breaking the Logan Act, give facts to DOJ + have them decide." The memo appeared to weigh the pros and cons of pursuing those different paths, while cautioning: "If we’re seen as playing games, WH [White House] will be furious."

Aside from swiftly being ensnared in Special Counsel Robert Mueller's investigation in the fallout from that interview, Flynn was fired from his prominent post as national security adviser in February 2017. The resignation came as he was accused of misleading Vice President Pence and other senior White House officials about his communications with Kislyak.

Flynn's communications with Kislyak in December 2016 had been picked up in wiretapped discussions, apparently unbeknownst to him. The FBI agents in January 2017 questioned him on the communications and later used his answers to form the basis for the false-statement charge and his guilty plea.

Director of National Intelligence John Ratcliffe made transcripts of those wiretapped calls between Flynn and Kislyak public earlier this month.

Fox News' Tyler Olson, Bill Mears and Jake Gibson contributed to this report.