By Gretchen Ehlke and Ivan Moreno, Associated Press

A police officer shot an armed male student in a classroom at a suburban Milwaukee high school Monday morning after the teenager pointed a gun at officers, a police chief said.

Officers performed life-saving measures on the 17-year-old Waukesha South High School student, who is in custody and in stable condition, and no officers or other students were injured, Waukesha Police Chief Russell Jack said.

The shooting happened after another student told a school resource officer that a classmate had a handgun around 10:17 a.m., Jack said. He said the resource officer went to the classroom to confront the teen and move other students in the room to safety. Authorities have not said if other students were in the classroom during the ensuing standoff, and Jack did not immediately respond to an email seeking clarity.

Waukesha police and sheriff’s deputies soon arrived at the school and tried to de-escalate the situation to no avail.

“The suspect would not remove his hands from his pocket and continued to ignore officers’ commands,” Jack said. “The suspect removed his handgun from his waistband and pointed it at the officers. An officer was forced to discharge his firearm, striking the suspect.”

The officer who shot the student is an 11-year veteran of the Waukesha Police Department, Jack said.

Police have not said whether the student ever fired his weapon. Police said the shooting was an isolated incident and that they are not seeking any other suspects.

Andrew Oresick, 16, told the Journal Sentinel that he was outside his Spanish class hanging posters with other students and their teacher when they heard a commotion.

“These kids start running out from the classroom directly across from us, and one of them goes: ‘He’s got a gun,’” Oresick recalled. He said their Spanish teacher immediately got them into the classroom.

Parents gathered outside and hugged students as they streamed out of the school about 18 miles (30 kilometers) west of Milwaukee. Some students said they took cover under desks and teachers barricaded doors when a drill was announced. They told reporters outside the school that they knew it wasn’t a drill when they heard two or three gunshots.

“It was just really scary,” Alexis Grady, a senior, told the Journal Sentinel.

School shootings have occasionally shone a spotlight on the response by guards and school resource officers. Armed school resource officers have rarely prevented a school shooting.

Last year, armed guards at three high-profile school shootings — Marshall County High School in Benton, Kentucky; Marjory Stoneman Douglas High School in Parkland, Florida; and Santa Fe High School in Texas — were unable to stop the rampage.

In Parkland, the school’s resource officer remained outside rather than enter the building to engage the shooter and try to end the attack.

Gun-rights advocates believe having more armed educators and law enforcement in schools will help stop a shooter in his tracks. Gun-control advocates contend that arming teachers and having more guns in a school will do little to prevent school shootings and that such moves could put kids at greater risk.

An estimated 43% of public schools have an armed law enforcement officer on-site, according to a survey by the National Center for Education Statistics. The survey covered the 2015-16 school year, the most recent year surveyed. That figure doesn’t include schools with armed private security guards or teachers and administrators who carry firearms.