Transcript for Officer shoots armed former student at Illinois high school
graduation. It happened in Dixon, Illinois. A fellow senior with the gun. And then, the hero officer. Here's ABC's Alex Perez. Reporter: Horrified students hugging in relief outside an Illinois high school, after a tragedy is averted by a quick-thinking school resource officer now being called a hero. Shots fired at Dixon high school. Shots fired at Dixon high school. Reporter: Police say it began just after 8:00 A.M., when a 19-year-old student showed up with a gun and opened fire. Shooting near a gym packed with seniors rehearsing for graduation. All I heard was something like, that sounded like firecrackers. The popping scared everybody. Reporter: School resource officer mark Dallas immediately jumping into action, chasing the gunman out of the school. With shots ringing out through the hallways of the school, he charged towards the suspect and confronted him head-on. Reporter: The suspect, Matt Milby, firing at the officer as he fled the building. Dallas, returning fire, striking him. Tonight, the alleged shooter's mother saying she's grateful the officer did not take her son's life, as officers begin their investigation. There's no justification for what he's done. Let's get to Alex Perez. Tonight, police are crediting that officer and the training he received, Alex? Reporter: That's right, David. The sheriff here tells me that officer has been in law enforcement for about two decades. He made a split-second decision to chase the gunman out of the school. A decision that authorities here say absolutely saved lives. David? Alex, thank you.
This transcript has been automatically generated and may not be 100% accurate.