ALFRED (AP) — A man charged with raping a 14-year-old Sanford girl as she walked to school has changed his plea mid-trial.

Dane Bosley pleaded guilty Wednesday to gross sexual assault as the second day of his trial in York County Superior Court was about to begin. In exchange, prosecutors dropped charges of kidnapping, criminal threatening with a dangerous weapon, and assault.

The Portland Press Herald (http://bit.ly/15Z9cX6 ) reported that as part of the plea, Bosley agreed to a prison sentence of at least 14 years. Sentencing is scheduled for July 11.

The victim, now 19, testified that as she was walking to school in October 2008 she was threatened with a knife and sexually assaulted.

Bosley was tied to the crime through DNA evidence.

He had claimed the sex was consensual.