A police officer has settled his discrimination lawsuit with the St. Louis County police department for $10.25 million after he sued them for passing him over for promotions because he’s gay.

It has been an over three-year battle for Keith Wildhaber, who alleged in 2016 that a member of the police civilian board told him to “tone down your gayness” if he ever wanted to be promoted. The board member claimed he said no such thing.

Related: Gay police officer was accused of pedophilia for coming out to teens. Now he’s suing.

Despite ranking highly on tests to become a lieutenant, Wildhaber was passed over for a promotion 23 times. When he filed a discrimination suit, he was transferred to the night shift on the other side of the county, which he also sued over, claiming it was retaliation.

Wildhaber has also blamed police Chief Jon Belmar for his treatment, saying he cultivated a culture of discrimination.

In 2019, a jury sided with Wildhaber on both counts and ordered the police department to pay almost $20 million in damages. The high number was meant to set an example.

“If you discriminate you are going to pay a big price.… You can’t defend the indefensible,” the jury foreman told St. Louis Today at the time.

But it didn’t end there. St. Louis County appealed, arguing that discrimination based on sexual orientation is perfectly legal in Missouri. Wildhaber’s lawsuit had said that he faced discrimination based on his sex and stereotypes associated with that sex because his “behavior, mannerisms, and/or appearance do not fit the stereotypical norms of what a ‘male’ should be.”

The Associated Press is reporting that Wildhaber and St. Louis County reached a settlement on Monday.

Monday was also the day Chief Belmar announced his retirement. County Executive Sam Page said Belmar’s retirement was not a condition of the settlement and he was already planning to retire this year.

Since the lawsuit, Page has replaced four out of five police commissioners in hopes of changing the culture of the department. He said he believes Belmar waited to retire until the lawsuit was finished to help lead the department through this time of change.

The settlement will work in Wildhaber’s favor, as he will be able to avoid the appeals process and keep more of the money. In December, he was also promoted to lieutenant and is now heading a new diversity unit.

“This lawsuit acknowledges what Lt. Wildhaber survived in the police department and lets us move forward as a county,” Page told the AP. “I think it’s important to recognize that this sends a message to everyone in county government and to all of our employers in the St. Louis region, that discrimination will not be tolerated.”