A veteran St. Louis cop who was told to tone down his “gayness” to get a promotion has been awarded almost $20 million, according to a report.

Sgt. Keith Wildhaber said he was passed over 23 times for a promotion at the St. Louis County Police Department and then punished with a transfer when he complained, the St. Louis Post-Dispatch said.

His captain, Guy Means, privately called him “fruity” and told a friend that the officer was “way too out there with his gayness and he needed to tone it down” to get a promotion, the jury heard, according to the report.

“We wanted to send a message,” the jury foreman told the paper of the huge payout awarded after three hours’ deliberation Friday.

“If you discriminate, you are going to pay a big price. … You can’t defend the indefensible.”

Wildhaber was awarded $1.9 million in actual damages and $10 million in punitive damages for discrimination. He also got $999,000 in actual damages and $7 million in punitive damages for his retaliation claim, according to the paper.

Means was accused of making his outlandish comments about Wildhaber to Donna Woodland, a colleague’s girlfriend, at a 2015 event. He denied knowing her or remembering the event, the report said.

But Woodland produced photo-booth pictures from the night showing Means giving her warm hugs — images that four jurors told the Post-Dispatch were key in dismissing the captain’s denials.

“The county should be ashamed,” Wildhaber’s attorney, Russ Riggan, told the hearing. “Our community deserves better.”

Riggan told the jury during his closing argument that their decision would have “far-reaching” implications in the fight against workplace discrimination, according to the report.

County Counselor Beth Orwick told the Post-Dispatch that county officials “will be exploring all of our legal options” to “do what’s best for the county.”

With Post wires