CHEYENNE, Wyo. (AP) — A registered sex offender has been sentenced to 45 to 60 years in prison after admitting he hit a Cheyenne woman in the head with a rock, hoping to knock her out so he could have sex with her.

47-year-old Richard Megeath was sentenced Friday soon after pleading guilty the attempted sexual assault of a woman in November 2016.

Court records say Megeath was convicted of second-degree attempted sexual assault in 2005 and aggravated assault and battery in 1994. He pleaded guilty in July 2016 to failing to update his sex offender registration.

District Judge Thomas Campbell told Megeath that whatever is wrong with him is "so serious, so dark and so unpredictable ... it would justify any sentence this court would impose." However, Campbell followed the plea agreement.