HASTINGS, Minn. - A 26-year-old former teacher will serve 30 days of house arrest for the next five years after pleading guilty to stalking a middle school student on social media.

Cody Woodrow Hansen, who once taught at an Eagan middle school, had his sentence stayed, and was put on five years probation for his interactions with the 12-year-old on Snapchat.

The victim told investigators Hansen repeatedly contacted her, using a number of user names based on versions of his proper name to send the messages to her anonymously between November of 2015 and January of 2016. The exchanges occurred during the school day as well as during the holiday break.

In one of the messages, Hansen told the student he thought she was cute. In another he asked her if she had ever kissed anyone and if she liked older men. As the student tried to determine who was sending these messages, Hansen admitted he could get into trouble for talking to the student and stated, “This is Mr. H”. During one exchange the student told Hansen that what he was doing was illegal and extremely weird. The student reported to the police officer that she felt creepy and unsafe to be in Hansen’s classroom. She saved several screen shots as evidence.

Hansen admitted to detectives that he sent the messages to the student, and that he found the student’s Snapchat username from her Instagram account and used four separate usernames to message with her. Hansen stated that he had stopped communication with the student and “hoped this would all go away.”

“We are pleased to have held this former teacher accountable for this troubling and inappropriate behavior which is a crime under Minnesota law,” said Dakota County Attorney Jim Backstrom after Hansen was sentenced.