An emergency vehicle appears outside Dixon High School Wednesday, May 16, 2018 in Dixon, Ill. Officials say a police officer has shot and wounded a gunman at a northern Illinois high school. The Dixon city manager Danny Langloss says police confronted a former male student with a gun on school property about 8 a.m. Wednesday. Langloss says the gunman shot at an officer who returned fire and hit him. He is in custody with what Langloss described as non-life-threatening injuries. (Rachel Rogers/Sauk Valley Media via AP)
An emergency vehicle appears outside Dixon High School Wednesday, May 16, 2018 in Dixon, Ill. Officials say a police officer has shot and wounded a gunman at a northern Illinois high school. The Dixon city manager Danny Langloss says police confronted a former male student with a gun on school property about 8 a.m. Wednesday. Langloss says the gunman shot at an officer who returned fire and hit him. He is in custody with what Langloss described as non-life-threatening injuries. (Rachel Rogers/Sauk Valley Media via AP) Credit: Rachel Rogers

Dixon, Ill. (ap) — A police officer at a northern Illinois high school was hailed as a hero on Wednesday for shooting and arresting a former student who fired on him in a hallway while staff and seniors were meeting for a graduation rehearsal.

The 19-year-old former Dixon High School student suffered wounds that weren’t life threatening, according to police, who didn’t release his name. The school resource officer, Mark Dallas, took the gunman into custody after shooting him.

“He saved an enormous amount of lives,” Lee County Sheriff John Simonton said. His comments were echoed by Illinois Gov. Bruce Rauner, who in a statement credited “Dallas for his bravery and quick action to immediately diffuse a dangerous situation.”

The shooting happened shortly after 8 a.m. while staff and students were gathered for a graduation rehearsal. Police Chief Steven Howell Jr. said several shots were fired near the auditorium, and Dallas rushed to the area to confront the gunman.

Howell said Dallas chased the suspect after he fled from the school. The suspect fired several shots at the officer, who returned fire, wounding the suspect and taking him into custody.

Neither Dallas, who’s been a resource officer at the school for five years, nor anyone else at the school was injured. Police said they believe the gunman acted alone and that there was no further threat to anyone in the area. Howell declined to discuss why the former student brought a gun to the school.

“I could not be more proud of the police officer and the way he responded to the situation. With shots ringing out through the hallways of the school, he charged towards the suspect and confronted him, head on,” Howell said of the 15-year veteran of the Dixon Police Department. “Because of his heroic actions, countless lives were saved. We are forever indebted to him for his service and his bravery.”

“A lot of things went right today and many things could have gone wrong,” Dixon Mayor Liandro Arellano Jr., told reporters at a news conference outside the school.