A school resource officer is being hailed as a hero after he exchanged gunshots Wednesday morning with a 19-year-old former student who fired several shots at Dixon High School in Illinois.

“From the angle I’m looking at right now, a lot of things went right when a great many of them could have gone wrong,” Dixon Mayor Li Arellano Jr. said at a news conference Wednesday.

Authorities first got reports of an armed man on campus just after 8 a.m., police Chief Steve Howell said. The gunman, whose name was not released, was confronted by a school resource officer after he fired several shots near the west gym, Howell said.

The gunman ran when he saw the officer, who chased after him.

Howell said the suspect fired several shots at the officer as he tried to get away, but the officer was not injured. The officer returned fire, striking the gunman, according to authorities.

The suspect was taken to a hospital for treatment of his wound, which did not appear to be life-threatening, Howell said. The officer, who was not identified, was placed on paid administrative leave as is standard in similar cases, according to the chief.

No other injuries were reported.

“I cannot be more proud of the police officer and the way he responded to the situation,” Howell said. “With shots ringing out through the hallways of the school, he charged toward the suspect and confronted him, head-on. Because of his heroic actions, countless lives were saved.”

Dixon High School and nearby campuses were placed under lockdown as authorities searched the school for any signs of another shooter. Investigators believe the unidentified suspect acted alone.

Howell said officers found students and staff members behind doors barricaded with desks and bookshelves while they were clearing the school.

“The students and staff responded to this situation extremely well,” he said.

All students have since been reunited with their families.

The circumstances leading to the shooting were not immediately clear. Authorities did not say what motivated the attack.

Police continue to investigate.