A former high school teacher was sentenced Friday to 10 years in prison after pleading no contest to charges that he had sex with a 16-year-old student in his classroom.

Shawn Trotter, 34, a former history teacher at South Fork High School, had been charged with three counts of sexual activity with a minor. In his plea deal with prosecutors, Trotter also received 10 years of probation and will have to register as a sex offender.

Trotter's father-in-law, Richard Mulanax, told The Palm Beach Post that Trotter was innocent but accepted the plea to avoid a trial and the risk of a possible 45-year prison sentence.

The investigation began after two students told school officials they knew of a teacher who was having a sexual relationship with another student, according to a Martin County sheriff's report.

The 16-year-old girl acknowledged to detectives she had sex with Trotter, authorities said.

According to the report, Trotter and the girl had sex in a classroom storage closet after school on Jan. 18. The two had sex two more times over the next two weeks, the report said.

Trotter was arrested in February.