LARAMIE, Wyo. (AP) — A Wyoming man accused of sexually abusing a Laramie teen has been sentenced to prison time.

Kenneth Lovato, 51, will serve 36-40 years in prison for two counts of second-degree sexual abuse of a minor. He pleaded guilty in a last-minute agreement with prosecutors before he was scheduled to stand trial.

District Court Judge Tori Kricken says the plea agreement was declined because of Lovato's history of sexual abuse of minors.

According to court documents, Lovato has two previous convictions for sexual abuse of a minor from California and New Mexico. He was arrested in July 2016 after police found evidence linking him to the sexual abuse of a Laramie minor.