(CNN) -- Jury selection was minutes away for five ex-New Orleans police officers accused of shooting unarmed civilians after Hurricane Katrina when a commenter ripped into the defendants on a newspaper website.
"NONE of these guys should had have [sic] ever been given a badge," the commenter, identified only as "legacyusa," wrote. "We should research how they got on the police department, who trained them, who supervised them and why were they ever been promoted. You put crap in -- you get crap out!!!"
"Legacyusa" turned out to be one of the top federal prosecutors in New Orleans. His post was just one of many anonymous barbs that led a federal judge Tuesday to throw out the convictions of those ex-cops in the Danziger Bridge shootings, which left two people dead and four seriously wounded.
In a 129-page ruling, District Judge Kurt D. Engelhardt cited long list of "egregious and inflammatory" comments by at least three Justice Department officials using a variety of online identities. Those comments fueled a "21st century carnival atmosphere" that tainted the 2011 trial and will require a new one, Engelhardt wrote.
"This case started as one featuring allegations of brazen abuse of authority, violation of the law and corruption of the criminal justice system; unfortunately, though the focus has switched from the accused to the accusers, it has continued to be about those very issues," the order states. "After much reflection, the court cannot journey as far as it has in this case only to ironically accept grotesque prosecutorial misconduct in the end."
In a statement issued Tuesday afternoon, the Justice Department said, "We are disappointed with the court's ruling. We are reviewing the decision and considering our options."
The five officers were charged with firing on an unarmed family at the New Orleans bridge and at others who were attempting to flee the scene, which unfolded six days after Katrina flooded most of the city. They were found guilty on a total of 25 counts of civil rights violations, and in 2012, Engelhardt sentenced them to prison terms ranging from six to 65 years.
Justice Department rules forbid prosecutors from making public comments that might influence the outcome of a case. But lawyers for the convicted officers accused prosecutors of mounting "a secret public relations campaign" aimed at discrediting the defendants before trial.
"The government's actions, and initial lack of candor and credibility thereafter, is like scar tissue that will long evidence infidelity to the principles of ethics, professionalism and basic fairness and common sense necessary to every criminal prosecutor, wherever it should occur in this country," Engelhardt wrote in granting them a new trial.
"Given the time, effort and energy invested by the court in this matter from the beginning, this is indeed a bitter pill to swallow," he added.
Two top lieutenants of then-U.S. Attorney Jim Letten -- the office's top trial lawyer, Sal Perricone, aka "legacyusa" and other handles; and Jan Mann, the first assistant U.S. attorney -- had already been identified as having posted disparaging comments anonymously.
Perricone had been trash-talking the New Orleans Police Department from then-Superintendent Warren Riley on down since at least 2008, Tuesday's order states. Six months before the Danziger Bridge trials opened, with other officers on trial for their conduct in the post-Katrina chaos, Perricone called the NOPD "a collection of self-centered, self-promoting, insular, arrogant, overweening, prevaricating, libidinous fools ... the entire agency should be re-engineered from the ground up."
The third official cited in the order was Karla Dobinski, a senior attorney in the Justice Department's civil rights division. In the Danziger Bridge case, Dobinski had led the department's "taint team" -- the group charged with reviewing evidence to make sure no statements given under a grant of immunity get used against defendants.
Though not part of the prosecution, she posted to the New Orleans Times-Picayune six times during the trial to praise pro-prosecution commenters, according to Engelhardt's order. Dobinski told investigators she was trying to get information "otherwise unavailable from the prosecution team," the order states. But Engelhardt said it was "difficult to accept" that explanation and said she "fanned the flames" of those calling for a guilty verdict.
Mann and Perricone have left since their involvement was revealed in 2012, said Anna Christman, a spokeswoman for the U.S. attorney's office. The Justice Department did not immediately respond to questions about Dobinski.
Former officer Robert Faulcon got the longest sentence of the Danziger Bridge defendants, at 65 years. The lightest term went to former detective Sgt. Arthur Kaufman, who was sentenced to six years for attempting to cover up what the officers had done.
Two former sergeants, Kenneth Bowen and Robert Gisevius, got 40-year terms for their roles. Ex-officer Robert Villavaso was sentenced to 38 years.
CNN's Kay Jones contributed to this report.