A former South Carolina police officer filed a lawsuit against his former employer, claiming he was unjustifiably fired over a photo of himself posing in Confederate flag underwear during last summer’s debate over the flag and other Confederate symbols.

Former Sgt. Shannon Dildine wrote that he was aware of the debate, which exploded after a white man charged with shooting nine black people to death at a Charleston church was shown in online photos embracing Confederate symbols and talked about wanting to start a race war.

Dildine was an officer in North Charleston at the time – about 6 miles about north of Emanuel AME Church in downtown Charleston. He said he was on vacation when the shootings happened and wasn’t aware that alleged shooter, Dylann Roof, had been seen glorifying the flag.

The veteran officer posted the photo of himself days after Roof allegedly shot churchgoers during a Wednesday night Bible study, saying in his lawsuit he did so “to diffuse a debate that two of his Facebook friends were having over the Confederate flag issue.”

The department called the officer about the photo, which he said was deleted from social media immediately. He was fired days later, told he was being terminated because of the photo.

In his lawsuit against the city, Dildine said that he is not a racist and views the flag as part of his southern heritage. He said Reggie Burgess, a black officer who posted a photo of himself alongside someone wearing a "Black Lives Matter" shirt, was not fired or disciplined afterward. Dildine claims because he was fired and Burgess was not is clear evidence of discrimination.

Dildine, citing post-traumatic stress and humiliation, is asking for unspecified monetary damages, according to The Post and Courier.

“We have two claims: freedom of speech and race discrimination,” Chris Potts, his attorney said. “He was fired for expressing his First Amendment rights. ... And a white officer who does something is treated more harshly than a minority officer who does something.”

North Charleston Mayor Keith Summey and other officials have stood by their decision to dismiss Dildine. Summey told The Post and Courier that firing Dildine was “the right thing to do.”

The Associated Press contributed to this report.

Click for more from The Post and Courier.