A former South Carolina police officer says he was unjustifiably fired over a photo of himself posing in Confederate flag underwear.

In his federal lawsuit filed this week, Sgt. Shannon Dildine says he knew about last summer's debate over the flag but was on vacation during the shooting at Charleston's Emanuel AME Church and wasn't aware that alleged shooter, Dylann Roof, had been seen in photos glorifying the flag.

The veteran South Charleston officer posted the photo days after Roof allegedly shot nine black people to death. He was fired days later.

Dildine says in his lawsuit against the city that he is not a racist and views the flag as part of his southern heritage.

City and police officials didn't immediately return emails seeking comment Friday afternoon.