PINEVILLE, Mo. (AP) — A judge has dismissed a charge accusing a former southwest Missouri student teacher of having sex with a high school student.

Twenty-four-year-old Caleb Littlefield, of Pineville, was charged in March with having sexual contact with a McDonald County High School student two years ago while he was a student teacher at an elementary school in the district. The Joplin Globe reports a judge dismissed the charge last week.

Littlefield’s attorney argued in his motion to dismiss that state law prohibits teachers from having sex with students in the schools where they work.

In this case, the student was of the legal age of consent and Littlefield did not teach at the high school where she was a student.