A San Francisco Superior Court judge has ruled that police officers who sent racist and homophobic text messages can't be fired because the city missed a deadline.

Judge Ernest Goldsmith said that California's Peace Officer Bill of Rights bars San Francisco from taking action against the officers after a one-year statute of limitations. "It is not in the public interest to let police misconduct charges languish," he said, according to a report in the San Francisco Chronicle. “The public has a right to have accusations against police officers be promptly adjudicated.”

The messages came out in court documents as part of a federal corruption investigation in February 2014. However, lawyers for the accused police officers say the San Francisco Police Department first learned about the texts in December 2012. But it wasn't until April 2015 that Police Chief Greg Suhr moved to fire eight of the officers and discipline the other six.

An attorney for the city said yesterday that police officials couldn't act on the messages without jeopardizing the corruption case against former officer Ian Furminger, who was sentenced in February to almost four years in prison. Furminger was found to have taken cash during searches of drug dealers' homes.

The judge disagreed, saying the text messages weren't related to the facts of the Furminger case and that the city could have begun a probe after Furminger was indicted in February 2014.

The messages included remarks calling African-Americans "monkeys" and talk about killing "half-breeds." Other messages said "we celebrate whiteness" and suggested African-American women "should be spayed."

Speaking after yesterday's decision, Police Chief Suhr said he'll appeal Goldsmith's ruling.

"We’re confident in our position that we acted in a timely fashion and that the criminal case appropriately took precedent," Suhr said. "Anybody capable of the reprehensive texts that these guys sent should not be police officers, and we will work for that to be the case."

The 14 officers were originally suspended without pay, but Goldsmith ruled in May that they must be put on paid leave. Three of the eight officers the city wants to fire have resigned, although one of them, Michael Celis, is seeking to return to duty after learning about the statute of limitations issue.

"The public has a right to have police officers not express themselves in this way and not think in this way—no one is saying differently," said Tony Brass, a lawyer representing Celis. “The important thing is that these officers only texted that kind of material because that’s what their sergeant wanted... That was his code to be in a club that officers had to be in if they were going to be successful."

"The fact that San Francisco is forced to retain police officers that demonstrated explicit racism will have ramifications for the reputation of the department, the fair administration of justice, and the trust of the community SFPD serves," said District Attorney George Gascón.