An Illinois school resource officer stopped an armed teenager at a high school Wednesday morning, according to the local police chief, who applauded the officer for saving "countless" lives.
When the 19-year-old suspect fired several shots near a gym at Dixon High School, the school resource officer reported the incident to authorities and then confronted the gunman, Dixon police chief Steven Howell said at a news conference.
When confronted, the suspect -- a former student at Dixon High School -- started running away, and the officer pursued him, Howell said. The suspect shot several rounds at the officer, and the officer then returned fire, hitting the gunman, the chief added.
The suspect was taken into custody with what are believed to be non-life-threatening injuries, police said.
The suspect was identified on Wednesday evening as Matthew A. Milby, according to Illinois State Police. He faces three charges of aggravated discharge of a firearm.
Milby is currently under surveillance at a hospital and will be taken to jail when he is discharged, state police said.
No students or staff were injured but the high school and all other schools in the district were placed on lockdown, Dixon City Manager Danny Langloss said in a statement.
Senior Devin Scott said he was in the gym this morning when he heard what sounded like fireworks.
"It was a little unreal," he told ABC News.
The weightlifting coach then ran into the gym and alerted the students -- who were all seated in the bleachers for graduation practice -- to run and get to safety, Scott said.
"Some started crying as they started running," Scott said. "It was scary. My life could have ended."
His brother, junior Skylar Scott, said he was in class when the teacher alerted the students and activated their active shooter response plan.
The students cleared tables and moved them behind the classroom door to block the entrance, Skyler Scott said, and then they quickly grabbed boxes and stacked them against the windows to block them from view from the outside.
Dixon police believe the suspect acted alone and that there is no further threat to the safety of students or staff, Langloss added.
Howell said he “could not be more proud” of the officer who ran toward the suspect and said his “heroic actions” saved "countless" lives.
The officer, whose name was not released by police, is on paid administrative leave, per policy, police said.
Illinois Gov. Bruce Rauner identified the officer as Mark Dallas, writing on Twitter, "We should all be very thankful to school resource officer Mark Dallas for his bravery and quick action to immediately diffuse a dangerous situation."
Today, we should all be very thankful to school resource officer Mark Dallas for his bravery and quick action to immediately diffuse a dangerous situation at Dixon High School.— Governor Rauner (@GovRauner) May 16, 2018
ABC News' Alex Perez and Andy Fies contributed to this report.