Imprisoned former State Sen. Vincent J. Fumo faces a new sentencing hearing after a federal appeals panel ruled Tuesday that the judge who gave him a 55-month term failed to take into account the sweep and severity of his crimes.

In a win for prosecutors, the panel said U.S. District Judge Ronald L. Buckwalter made several errors as he weighed Fumo's misconduct in 2009 and set a punishment far less than the 21 years or more that prosecutors said was warranted.

A key error was calculating the losses to the public from the former Democratic power broker's crimes, the U.S. Court of Appeals for the Third Circuit panel said in a 2-1 ruling. Buckwalter set the figure at about $2.5 million, but the appeals panel said the amount was nearly $4 million.

"The higher the loss amount, the longer the potential jail sentence will be," said Assistant U.S. Attorney John J. Pease, who prosecuted Fumo along with fellow prosecutor Robert A. Zauzmer.

"We're back up in the neighborhood of 20 years," Pease said.

Fumo, 68, is two years into his sentence, which he is serving at a federal prison in Kentucky. He was convicted of 137 counts of fraud, conspiracy, and obstruction of justice in a case that the appellate panel called "one of the largest political scandals in recent state history."

Dennis J. Cogan, Fumo's trial attorney, said a longer sentence was not a foregone conclusion.

"I'm disappointed that they're sending it back," he said, but added: "They don't suggest a higher sentence. They don't suggest for a second that this sentence should be any different."

Rather, Cogan said, "They're sending it back for the judge to correct what they perceive to be procedural errors."

The panel did affirm Fumo's conviction and that of his codefendant, his former aide Ruth Arnao, whose sentence of a year and a day for fraud, tax evasion, and obstruction was also vacated. She has served that term, but could face additional prison time at resentencing.

In a dissenting opinion, Judge Richard L. Nygaard agreed with his colleagues that the convictions should be upheld, but said he would have let the sentences stand.

For Fumo, the ruling sets the stage for a new sentencing hearing at which prosecutors will push for a longer prison term, and defense lawyers will contend that the initial sentence is sound and should stand.

Buckwalter's sentencing of Fumo sparked widespread criticism. The judge departed from federal sentencing guidelines in calculating how much time Fumo should spend behind bars and gave him credit for his "charitable service and good works."

Under a 2005 U.S. Supreme Court opinion striking down mandatory sentences, Buckwalter had that leeway.

He calculated sentencing guidelines of 121 to 151 months for Fumo, then adjusted downward to 55 months, citing the former senator's "extraordinarily hard" work on behalf of the public.

Prosecutors appealed the sentence as too lenient for a man convicted of defrauding a pair of nonprofit organizations, using taxpayer-paid state Senate employees for personal errands and political work, and staging a cover-up in an effort to thwart an FBI investigation.

While arguing the appeal in May, Zauzmer said that rather than working hard, Fumo spent months away from work, and rather than serving the public, he was "stealing money every day."

In the 62-page opinion overturning Fumo's sentence, Judge Julio M. Fuentes, joined by Judge Leonard I. Garth, said Buckwalter erred when he concluded that Fumo had not used "sophisticated means" to defraud the public.

Under federal sentencing guidelines, carrying out a sophisticated crime merits additional punishment. At Fumo's sentencing, Buckwalter asserted that the former senator's crimes had not been especially clever because reporters had spotlighted them.

The panel also said the judge mistakenly rejected prosecutors' contention that Fumo's sentence should be lengthened because he skimmed funds from a charity, Citizens Alliance, for personal use.

"Evidence of Fumo's intent to divert the funds was overwhelming," Fuentes wrote, adding that Buckwalter's refusal to take this into consideration in sentencing was "an abuse of discretion."

The jury found that Fumo used his Senate staff as personal servants, with one aide working as his housekeeper and another as his driver. It also found that he diverted money from a charity for personal and political use.

After his conviction, his lawyers had sought a new trial, contending that the jury's verdict was tainted because one juror posted messages about the case on Facebook and Twitter and another learned outside of court that Fumo had a past conviction (later overturned) in a corruption case.

Buckwalter had dismissed the juror's social-media postings as "nothing more than harmless ramblings having no prejudicial effect." And he said the other juror's exposure to outside information was not significant enough to warrant a new trial.

The appellate panel agreed on both counts.

Contact staff writer Nancy Phillips at 215-854-2254, nphillips@phillynews.com, or @PhillipsNancy on Twitter.

Staff writer Craig R. McCoy contributed to this story.