A Kansas lawmaker was accused in punching a high school student and threatening to “unleash God’s wrath.” He pleaded guilty three counts of disorderly behavior, according to court records.

State Rep. Mark Samsel was sentenced to 12 months of probation and ordered by a judge not to use his personal social media accounts, a district court order in Franklin County shows.

Kansas state Rep. Mark Samsel, R-Wellsville, talks on his cellphone ahead of the House’s daily session, at the Statehouse in Topeka, Kan., on May 3, 2021. John Hanna / AP file

Samsel, a Republican, was also told to write letters of apology over the incident, which occurred April 28 at Wellsville High School, about 40 miles southwest of Kansas City, and was partly captured on audio and video recordings published by the Kansas City Star.

According to an affidavit from a Wellsville police detective, Samsel, who was also a substitute teacher, spoke to a class about “the wrath of God and how rap music is wrong and kids should listen to other types of music.”

“Mark then began talking about how a Black boy he knows tried to commit suicide,” the affidavit says. According to the affidavit, Samsel began shouting and discussing the topic repeatedly. An unidentified student then put in his headphones.

The confrontation erupted when Samsel yelled and discussed the subject repeatedly. According to the affidavit, an unidentified student put in his earbuds, and Samsel threatened to unleash the wrath on him right now. He also kicked the student in the testicles.

Samsel was arrested for three misdemeanor battery charges and pleaded not guilty. He told local media at the time the incident was “planned,” and that he and the students aimed to send a message to parents and the city of Wellsville “about art, mental health, teenage suicide, how we treat our educators.”

Last month, Samsel surrendered his substitute teaching license and said “extreme” stress prompted an “isolated episode of mania with psychotic features” in the classroom.

Appearing in court via Zoom Monday, Samsel apologized, saying he never “intended for anyone to get hurt,” according to NBC affiliate KSNT.

Tim Stelloh is a reporter for NBC News based in California.