The officers embroiled in a scandal involving text messages that referred to blacks as “savages” and gays as “fags” managed to remain on paid leave and almost escape discipline, but a Wednesday ruling sends them back to court and could end in the firings that the former chief of police ordered in the spring of 2015.

An appeals judge on Wednesday reversed a previous court’s decision in December 2015 that the statute of limitations had lapsed on disciplining the San Francisco Police officers who exchanged racist, sexist, and homophobic text messages.

Under the previous court’s ruling, the officers who former Chief Greg Suhr recommended firing in 2015 were able to escape any discipline. Instead, the court said they could come off unpaid leave and go back back on the payroll.  

The lawyers defending the officers argued in court that the police department had acted on the texts too late, and any chance the city had to fire them had set sail one year after their discovery in a separate investigation in 2012.

However, in a stunning reversal, Justice Martin J. Jenkins of First Appellate Court said, not so fast: the internal investigators responsible for looking into the texts only became aware of them in December 2014 — and that is when the statute of limitations began, he ruled.

The police investigated the cases and Suhr sent his recommendations to the Police Commission in April 2015.  

At the time, Suhr sent the cases to the Police Commission, recommending that eight be fired. Six other officers faced lesser charges including two cases that went to the Police Commission and four that were handled by Suhr.

Six of the eight officers who Suhr recommended for firing have been on paid administrative leave and two have left the force.

The city will now have to ask a superior court judge to rule in its favor on the appeals court decision. If that happens, the Police Commission will decide whether the officers get to keep their jobs.

“It is high time to proceed with a full and fair disciplinary process for the officers in question,” said City Attorney Dennis Herrera following the judgement.

It is unclear if the officers will remain on paid leave. So far, they have racked up some $2 million in pay since the judge ruled in their favor in 2015.

The whole debacle began in December 2014 when former Mission Station Sergeant Ian Furminger was sentenced to three and a half years in prison for robbing and stealing from citizens.

During the course of the investigation that began in 2011, federal investigators discovered the bigoted text messages, but by law could not release them — not even to the SFPD body tasked with investigating administrative misconduct.

After the Furminger trial ended and the texts were released, the SFPD’s internal investigators kicked off a probe of their own, leading to Suhr recommending their termination.

Months later, however, the officers filed a lawsuit against the city alleging that the statute of limitations for investigating the matter had run out one year after the initial discovery of the texts.

In late 2015, a judge ruled in the officers’ favor: the SFPD had known about the texts and did not act soon enough. A separate body of internal affairs, the “criminal division,” had indeed known about them, but were legally unable to share the information with the rest of the department.

On Wednesday, however, the appellate judge found: “ … the one-year statute of limitations did not begin to run until the text messages were released by the [U.S. Attorney’s Office] to [SFPD’s Administrative Internal Affairs Division] because before then, the alleged misconduct was not and could not be discovered by the person[s] authorized to initiate an investigation ….”

“We’re very pleased the court found that police officials do not have to compromise a criminal investigation in order to pursue discipline against officers accused of abhorrent behavior,” Herrera said. “Forcing public officials to choose between the two would have made a mockery of justice.”