A Michigan man who told police he beat his two-year-old daughter to death in an attempt to turn her off men has been sentenced to 40 years in prison with a non-parole period of 18 years and 9 months.

23-year-old Donovan Haynes pleaded no contest to a charge of second degree murder in what Genesee Circuit Judge Joseph J Farah told the court was one of the worst things he had ever had to hear about in his time on the bench.

‘You don’t beat her in hopes she’s going to turn gay,’ Farah said, according to MLive.

Haynes will also serve a concurrent sentence of between 5 to 15 years for first degree child abuse over the killing.

Investigators told the court that Haynes had beaten his daughter Ti’Airra in the hope that it would make her a lesbian so she would stay away from men like him as he had a history of treating women badly.

Ti’Airra was pronounced dead at Hurley Medical Center after she stopped breathing at a home on Donal Drive in Flint Township in July of 2011.

A medical examiner’s report found that she died of internal bleeding from a lacerated liver which was sustained during the beating.

Haynes could have been facing life imprisonment if he had been found guilty of first degree murder and torture but he agreed to a plea bargain arrangement with prosecutors.