A divided federal appeals court has ordered the dismissal of the criminal case against President Donald Trump’s former national security adviser Michael Flynn, turning back efforts by a judge to scrutinise the Justice Department’s extraordinary decision to drop the prosecution.

The US Circuit Court of Appeals for the District of Columbia said in a 2-1 ruling on Wednesday that the Justice Department’s move to abandon the case against Mr Flynn settles the matter, even though Mr Flynn pleaded guilty as part of special counsel Robert Mueller’s Russia investigation to lying to the FBI.

The ruling, a significant win for both Mr Flynn and the Justice Department, appears to cut short what could have been a protracted legal fight over the basis for the government’s dismissal of the case.

It came as Democrats question whether the Justice Department has become too politicised and Attorney General William Barr too quick to side with the president, particularly as he vocally criticises, and even undoes, some of the results of the Russia investigation.

The House Judiciary Committee held a hearing Wednesday centred on another unusual move by Barr to overrule his own prosecutors and ask for less prison time for another Trump associate, Roger Stone.

Barr has accepted an invitation to testify before the panel on July 28, a spokeswoman said Wednesday, and he will almost certainly be pressed about the Flynn case.

Mr Trump tweeted just moments after the ruling became public: “Great! Appeals Court Upholds Justice Departments Request to Drop Criminal Case Against General Michael Flynn.”

Later, at the White House, Mr Trump told reporters he was happy for Mr Flynn.

“He was treated horribly by a group of very bad people,” Mr Trump said. “What happened to Gen. Flynn should never happen in our country.”

Mr Flynn called into conservative commentator Rush Limbaugh’s radio show and said the ruling was a good development for him and his family.

But he also called it “great boost of confidence for the American people in our justice system because that’s what this really comes down to – is whether or not our justice system is going to have the confidence of the American people.”

US District Judge Emmet Sullivan had declined to immediately dismiss the case, seeking instead to evaluate on his own the department’s request.

He appointed a retired federal judge to argue against the Justice Department’s position and to consider whether Mr Flynn could be held in criminal contempt for perjury. He had set a July 16 hearing to formally hear the request to dismiss the case.