A student at Park City High School in Park City, Utah, has admitted to releasing pepper spray inside a lecture hall last month in an attempt to prevent the school’s Turning Point USA student group from hosting an event. The student said that he released the dangerous chemicals because he did not feel that the TPUSA event would be a “safe thing” to have at the school.

An 18-year-old Park City student, whose name has not been released due to having been a minor at the time of the incident, admitted to Judge Elizabeth Knight on Friday that he released pepper spray inside the school’s lecture hall last month to “disrupt” a Turning Point USA event expected to be held in the room later that day, according to The Park Record.

“I didn’t feel as though [the TPUSA event] was a very safe thing for a lot of our students to really have in our school, so I decided I wanted to disrupt it,” said the student during his hearing in 3rd District Juvenile Court on Friday, elaborating on his reasons for releasing the dangerous chemicals inside the lecture hall.

Following the student’s release of the pepper spray, the school was evacuated after students and staff members reported feeling ill, resulting in medical professionals arriving on the scene to treat those who had been exposed to the chemicals, which left one person hospitalized.

The TPUSA event, which had featured Prager University’s Will Witt, was relocated to Ecker Hill Middle School.

Judge Knight reportedly told the student that he had been shutting down speech because he did not agree with it, and suggested that he find less harmful means for protesting, if he chooses to do so again in the future.

The student, who had been facing 18 criminal charges, admitted in court to four class B misdemeanors, which included one count of criminal mischief, a third-degree felony, two counts of assault and one count of disrupting a meeting.

Judge Knight dismissed the remaining 14 charges and sentenced the student to 100 hours of community service.

Additionally, the student was ordered to write an essay about civility, write a letter of apology to the school’s resource officer who entered the school seeking to identify the substance, pay restitution to the school for clean-up costs, and pay the co-pay of the individual who was hospitalized as a result of the incident, according to The Park Record.

The student apologized for his actions in a statement during the hearing.

You can follow Alana Mastrangelo on Twitter at @ARmastrangelo and on Instagram.