BEMIDJI -- A 25-year-old man received a stayed prison sentence and five years of probation on Tuesday for having a sexual relationship with a minor.

Cody Allen Thomas Bernhardt of Lancaster, Minn., pleaded guilty in May to the charges of third-degree criminal sexual conduct and engaging in electronic communication relating to sexual conduct with a child. Judge John Melbye sentenced Bernhardt to 20 months in prison, but the stayed sentence means Bernhardt won’t have to serve that time as long as he successfully completes his probation.

Melbye outlined a number of specifications for Bernhardt’s probation, such as the fact that he is not allowed to have contact with minors younger than 18 and that he’s required to take part in an out-patient sex offender program. Bernhardt also will have to comply with the sex offender registry. However, the length of time he’s required to register as an offender won’t necessarily coincide with his five-year probation sentence.

Bernhardt declined to say anything during the sentencing hearing.

Bernhardt was arrested March 12 in Lancaster, located in far northwestern Minnesota and more than 150 miles from Blackduck, where he met with the victim. Officers found condoms in the center console of his vehicle, as well as a used condom in the rear seat.

Court documents did not specify what age the victim was, other than to say she was younger than 16. The victim’s parents contacted law enforcement after finding concerning messages on her phone. Bernhardt apparently continued to message with the victim even after learning how old she was.

The criminal complaint said that Bernhardt met the victim on the video-sharing platform TikTok several weeks before meeting in person. Bernhardt eventually drove to Beltrami County to meet the victim. The complaint said that he arrived at the victim’s home and convinced her to come out to his vehicle “after some coaxing.” The victim later told the authorities that she was in the vehicle with Bernhardt from roughly 1 to 8 a.m.

In the messages between the two, Bernhardt acknowledged having sex with the minor. He also indicated he wanted to meet with the victim again.