A former Willmar High School teacher was sentenced to three years in prison Monday for a sexual relationship with a student who was also on his hockey team.

Chad J. Akerson, 35, was taken into custody after an afternoon sentencing hearing in Kandiyohi County.

Akerson had pleaded guilty in October to one count of third-degree criminal sexual conduct. Prosecutors alleged he began having intercourse with the girl in early 2010, when she was 15, and continued a relationship with her until well after she became an adult.

The girl knew Akerson as a family friend and looked to him as a sort of father figure while her parents were going through a divorce, according to criminal charges. The two would have sex before, during and after school in various locations, the ­complaint said.

The relationship came to light because of a rumor around town, and after a legally mandated reporter went to police, a prosecutor had said.

Akerson resigned from his job at Willmar Senior High in October 2012, days after a complaint was made about him to school officials, records show. A police investigation was then launched.

The student had refused to give information to an officer in 2012, according to a Department of Education letter outlining its investigation. According to court papers, the student told police in November 2014 of a regular pattern of sexual intercourse with Akerson, saying it had ended in October of that year.

Akerson had gone on to work as a teacher in Ashby, Minn., where the district put him on unpaid leave after his Dec. 3 arrest last year.

As part of a plea agreement, first- and second-degree criminal sexual conduct charges against Akerson were dismissed.

Akerson's attorney, Ryan Garry, said his client made an emotional statement in the hearing Monday.

"He just said how sorry he was, what a mistake he made and how he one day hopes that he'll be forgiven by the victim," Garry said.