OGDEN, Utah (KTVX) — A 41-year-old man accused of trying to kidnap an 11-year-old girl from a Utah school is in custody, and a teacher is being hailed as “a hero.”

Ogden police arrived at Lincoln Elementary School in Ogden on Tuesday after the teacher was able to stop the suspect, later identified as Ira Cox-Berry, and get all 20 students off the playground and into the school, authorities said.

“An employee was watching the kids from the inside and observed the suspect walk up to this 11-year-old girl [on the playground] and put his hands on her in an attempt to take her,” said Lt. Brian Eynon, of the Ogden City Police Department. “He ran outside, the employee did, and confronted the suspect. At that same time, the girl had the ability to pull away from the suspect.”

Police said the suspect then approached the building and began punching the window in an attempt to force his way inside.

The teacher, who has a concealed carry permit, produced a firearm and held Cox-Berry off while calling 911, police said.

“This employee is protected under the Second Amendment. He followed all policy and procedure at the school, and in this particular case, did everything that he should have done to protect the innocent lives of the children at the school,” said Eynon. “And in this case, it is likely that a life was saved or injury to a life was prevented due to the actions of this heroic employee.”

Officers took Cox-Berry into custody after a brief struggle.

Eynon said the suspect appeared to be under the influence of drugs: “The suspect was high, high on some type of narcotic.”

Investigators said there is no link between Cox-Berry and the 11-year-old girl.

“This teacher, in particular, was very prepared emotionally to confront a suspect he didn’t know, that was most likely on drugs, could be dangerous, could have been armed, and he took it upon himself to protect and be a hero, frankly, for the children who were on scene there when this went down,” said Eynon.

Ogden School District’s Jer Bates also praised the teacher’s actions.

“A teacher intervened when there was a situation that threatened students’ safety. This teacher, this school employee, is a hero. We don’t disagree with that at all,” Bates said. “Yes, it was a very scary situation, something we take very seriously, but it came out with a good ending, meaning no students were physically harmed, no adults were physically harmed, that this was an incident where out emergency response protocols were acted out.”

The school district brought in counselors to help the students, including the 11-year-old girl.

“At this time, to the best of our knowledge, the student is coping quite well considering the very traumatic experience that they endured,” Bates said.

Cox-Berry was booked into the Weber County Jail on one count of child kidnapping, a first-degree felony. Police say more charges are pending.