Dixon Police Chief Steven Howell Jr. said school resource officer Mark Dallas called emergency responders around 8 a.m. He said shots had been fired near the high school gymnasium.
WATCH: "I thought it was going to be another mass shooting"
Howell said Dallas ran toward the shots, coming face-to-face with 19-year-old Matt Milby, a former student, holding a gun.
Milby ran away and out of the school. Police said he fired at Dallas when he tried to chase him down. That's when the officer fired back, hitting and injuring Milby.
"I could not be more proud of the police officer and the way he responded to the situation. While shots were ringing out through the hallways of the school, he charged towards the suspect and confronted him head on," Howell said.
Milby was the only person hurt in the incident, police said. He was taken into custody and treated for his wound, which city officials said was not life-threatening. He is expected to recover.
Brandon Stehl was inside the gym when he heard the gun go off.
"Then all of a sudden you hear the gunshots and everybody just looks over. People were laughing at first and then pandemonium broke out. People were rushing out all through the same door, it was just complete panic," he said.
Students and staff were quickly evacuated from the campus. Chopper 7 HD was over the scene around 9:30 a.m. and captured video of students boarding buses to be reunited with family members, who were waiting for them at a local park.
WATCH: Chopper 7 HD over Dixon High School
While police were quick to say there was no further threat to people in the area after the shooting, Dixon Public Schools remained on lockdown for some time.
Julie Milby, the alleged shooter's mother, said her son was ostracized at school and left to finish his credits outside of class.
"I know that he's been very sad for a long time," she said. "Well, my kid is laying up at the hospital shot. Thank God they didn't kill him, that's a blessing. Thank God he didn't kill anyone else."
Julie grew up with Dallas, the school resource officer.
"I honestly would have to tell him thank you because I think in most cases they would kill him," she said.
When officers went inside the high school, they said they saw students and teachers barricaded in their classrooms as they should have been. They have been going through training on what to do during an active-shooter situation. Authorities said they did everything right.
"A lot of things went right today, when a great many of them could have gone wrong," Dixon Mayor Liandro Arellano Jr. said at a press conference Wednesday.
Congressman Adam Kinzinger was briefed on the situation by Lee County Sheriff John Simonton. Kinzinger thanked the school resource officer in a statement released Wednesday:
"As we continue to gather more information about the shooting incident at Dixon High School this morning, I extend my deepest gratitude to the Dixon Police Department, and especially the School Resource Officer (SRO) on-site, for their swift action today and for keeping our students, teachers, and our community safe."
Dallas is a member of the Dixon Police Department. He was placed on administrative leave, since he was involved in the shooting.
The investigation is ongoing. Illinois State Police have secured Milby's home and will execute a search warrant.