San Francisco police have come under fire after federal prosecutors released racist and homophobic text messages between officers.

The texts have turned the case of six officers accused of stealing from drug dealers into a racially-charged scandal, putting the city in the national spotlight over policing in minority communities.

"We now know this can happen in San Francisco," San Francisco District Attorney George Gascon said. "We're certainly not immune to the problems that we have seen in Baltimore, Staten Island, South Carolina."

The latest turmoil comes amid growing tensions between police departments and communities of color. Large, sometimes violent protests over police treatment of black suspects have occurred in several cities over the last two years.

The tensions have placed police on the hot seat and it is not getting any cooler. Three Fort Lauderdale, Florida officers were fired last month and a fourth resigned after they were found to have exchanged racist messages about colleagues and the predominantly black neighborhood they patrolled.

San Francisco Police Chief Greg Suhr has moved to fire eight officers, two of whom have since retired. Six others are also facing some kind of discipline.

Meanwhile, the district attorney is looking into whether the department’s racial problems run deeper than the officers implicated.

"In the process of looking at the text messages, increasingly I became uneasy that this may not be localized to the 14 officers that were being reported, but that we may have some systemic issues," Gascon said.

The San Francisco police department has not faced allegations of discrimination since Officers for Justice, a group of minority officers, sued the department in 1973. After the Department of Justice join the suit, the department settled the case in 1979 and agreed to hire more minorities and women. Nearly half of the sworn officers are minorities today.

The news of the racist texts prompted outrage among the community, while Rev. Amos Brown, president of the city’s NAACP chapter and minister at Third Baptist Church said he wasn’t surprised.

"We have seen this. We have lived this. We have breathed this discrimination," he said.

At least one of the accused officers, Michael Robinson, is white and openly gay. Another, Sgt. Ian Furminger, is white. Officials have so far declined to release the racial composition of the other officers alleged to have sent racially-charged texts.

Officer Rain Daugherty said in a lawsuit filed Monday to halt his termination that he is “deeply ashamed” of the texts he wrote and that they are “unreflective of his strong commitment to exemplary community policing of all San Francisco’s diverse citizens.” Daugherty also argues that he and the other officers should not be fired because the department obtained the texts in December 2012 but did not start the disciplinary process until two years later.

The department said the texts were part of the corruption investigation and could not be disclosed until the criminal cases concluded.

It all started at the Henry Hotel in San Francisco's gritty Tenderloin neighborhood.  

Hotel residents arrested in police raids began complaining in late 2010 to their public defenders that officers had entered their rooms without warrants and, on occasion, stole their valuables.  

Public defender Jeff Adachi and his staff then obtained and sifted through 18 months of video surveillance captured by the hotel's security cameras. The videos showed officers entering the building then leaving with bags and other items that were never accounted for in evidence logs or court proceedings. The video also appeared to show officers entering rooms without warrants or permission from the residents.  

The public defenders used the videos to confront and contradict officers' testimony, leading to several criminal cases being dismissed. Adachi also called a news conference to announce his findings, releasing the incriminating videos.  

Taking note, federal authorities launched an investigation and charged six police officers with corruption and related charges. Investigators twice searched Furminger's cellphone, unearthing numerous offensive and racist texts with fellow officers. They included slurs against blacks, Mexicans, Filipinos and gays, and feature officers repeatedly using the phrase "white power."  

Furminger is currently serving a 41-month prison sentence in a Colorado prison. He is appealing his conviction, and his attorney Mark Goldrosen declined comment.  

In a court filing, Furminger denied that he was "a virulent racist and homophobe." The court filing said Furminger's "close friends include many persons of different races and different sexual orientation."

The Associated Press contributed to this report.