DES MOINES, Iowa (AP) — The Iowa Supreme Court on Friday upheld the conviction of a high school teacher who claimed his only physical contact with the student was hugging, finding that the hugging amounted to sexual misconduct in light of instant messages that showed she had "become the object of" his sexual desires.

Bradley Wickes, a 38-year-old former Camanche High School social studies teacher, was convicted in 2015 of a charge of sexual exploitation by a school employee and sentenced to five years in prison.

Although the only physical contact Wickes had with the 17-year-old student were hugs at school and school-related events, the court concluded that more than a thousand Facebook Messenger exchanges between them over 45 days indicated that she had "become the object of Wickes's fantasies and sexual desires, and the hugs that coincided with these messages were for his sexual gratification."

Wickes challenged the conclusion that hugging a student constituted sexual conduct. But the justices ruled against him, pointing out that rulings in other states — including Maryland in 2013, Oregon in 2009 and Vermont in 2006 — found that hugging can constitute sexual exploitation in certain cases. They said they would not narrow the scope of the teacher sexual exploitation law by finding that hugs alone cannot amount to sexual conduct.

The court acknowledged that there was no evidence showing that Wickes had engaged in a sex act with the teen or any physical contact other than hugging, but it said the Facebook Messenger exchanges show how attractive he found her and how he wanted a more intimate relationship with her.

"Of critical importance in our analysis is the context and circumstances that surrounded the physical contact — the hugs — that are at issue here," the court said. This context begins with Wickes initiating the text messaging and "continues with the scenario of a 36-year-old teacher incessantly messaging a 17-year-old female student to describe intimate details of his marriage and his sexual frustrations."

In one exchange, he wrote to her: "You're hot obviously. But you're soulful. I don't know how to explain it you're just captivating" and "you make me feel great."

In another, Wickes described how he liked to give sensual back rubs by "lightly caressing with finger tips and . . . spelling out words." He told the girl that he had "magical fingers," and that he would "trac(e) along the back side of the leg and circles around the knee."

Following this exchange, Wickes asked the girl, "Do you delete these messages? I think I'd be killed if your dad found them."

Within days of that message, the girl's family discovered the relationship and took her cellphone to the police. Wickes resigned and was charged soon thereafter.

Although the justices determined that the hugging was illegal in this case, they said teachers shouldn't be overly worried about innocent hugs with students.

"It is important to note that nothing should prohibit teachers from hugging students for reassurance, comfort, or in congratulation without putting themselves at risk of being charged with the crime of sexual exploitation," the court wrote.

The court also upheld Wickes' five-year prison sentence, finding that it wasn't cruel or unusual punishment.

"The fact that Wickes's crime involved hugs instead of an actual sex act does not take away from the emotional and psychological toll his actions had on the student he exploited," the court said, adding "his punishment reflects the fact that Wickes abused his position of trust as a teacher to sexually exploit a student for his own gratification."

Wickes' attorneys didn't immediately reply to a phone message seeking comment about the ruling.

___

Follow David Pitt on Twitter: https://twitter.com/davepitt