Updated

A resource officer may have prevented a massacre after a 19-year-old former male student allegedly brought a gun inside an Illinois school and opened fire.

The suspect shot several rounds at Dixon High School resource officer Mark Dallas, who returned fire and struck the gunman during the confrontation, WQAD reported. The officer was not hit by gunfire and the suspect had non-life-threatening injuries. No students or staff members were injured in the incident. The suspect was placed in police custody and received medical treatment.

Multiple sources identified the suspect to Sauk Valley but officials have not yet confirmed the report. The media outlet said the suspect was expelled from the school recently.

dd1c56a2-

Resource officer Mark Dallas was credited with saving lives on Wednesday after a suspect entered Dixon High School with a gun on Wednesday, May 16, 2018. (Dixon Police Department)

Dallas was given the school resource officer position after the school received a federal grant to "help prevent school violence." Officials said students followed protocol after having received training in an emergency situation. Officials said students barricaded the doors of classrooms after hearing gunshots.

The officer was praised by authorities for his quick action and for saving the lives of students and staff. He has been placed on paid administrative leave as per department policy, police said.

"I could not be more proud of the officer ... because of his heroic actions lives were saved," Dixon police Chief Steven C. Howell Jr. said.

4676dc59-dixon high school

No students or staff were injured in the incident at Dixon High School on Wednesday, May 16, 2018. (AP)

"He saved an enormous amount of lives in this school today," Lee County Sheriff John Simonton added.

Like Dixon High School, resource officers have been recently credited with stopping school shootings from becoming worse or preventing them all together.

In March, school resource officer Blaine Gaskill confronted gunman Austin Rollins, who shot Jaelynn Willey in the head at Great Mills High School in Maryland. Willey later died from the injuries she sustained. Rollins was fatally shot, but it was not immediately clear if he took his own life or was killed by the officer. Gaskill was credited with preventing further loss of life. He responded to the shooting within a minute.

blaine gaskill

Deputy Blaine Gaskill was credited with preventing any more loss of life during a school shooting in Maryland in March. (St. Mary County Sheriff's Office)

In April, Deputy James "Jimmy" Long of the Marion County Sheriff's Office was hailed a hero by his colleagues after he arrested suspected gunman Sky Bouche just three minutes after Bouche allegedly opened fire at Forest High School in Ocala, Fla., injuring one person.

jimmy long

Sheriff James “Jimmy” Long was hailed a hero for his quick response to a shooting at a Florida high school. (Marion County Sheriff’s Office)

Meanwhile, Scot Peterson, a former deputy with the Broward County Sheriff's Office was criticized after he did not enter Marjory Stoneman Douglas High School in Parkland, Fla., on Feb. 14 when 17 people were killed by an ex-student. An investigation was opened into the incident and Peterson resigned "rather than face possible termination." Surveillance video captured Peterson outside the school, appearing to take cover, as the shooting occurred.

Dixon High School and all other public schools in the area were placed on lockdown immediately after the incident occurred around 8:00 a.m. The Dixon Police Department believes the suspect acted alone and there is no longer any danger to students or faculty.

Sauk Valley said the incident occurred in the school's gymnasium as seniors gathered for a graduation ceremony practice. Police are continuing to investigate the shooting.

"We're lucky the officer was there. His brave actions saved a lot of lives," said City Administrator Danny Langloss, whose daughter was in the gym at the time of the incident.

Fox News' Nicole Darrah contributed to this report.