BAKERSFIELD, Calif. — (CNN) -- The teacher stood in the classroom, face-to-face with his 16-year-old student, who was holding a shotgun.
Ryan Heber, 40, talked to the teen, trying to persuade him to end an armed assault in which one student had already been shot.
Heber had no idea whether the student -- whose pockets were filled with ammunition -- would put the gun down or pull the trigger.
Campus supervisor Kim Fields helped distract the teen, allowing other students in the classroom to escape, while Heber talked to him, according to CNN affiliate KGET.
Eventually, the teen let go of the gun, and police took him into custody.
That was how police described the frightening situation Thursday at Taft Union High School, about 30 miles outside Bakersfield, California.
"To stand there and face someone that has a shotgun, who's already discharged it and shot a student, speaks volumes for these two young men and what they may have prevented," Kern County Sheriff Donny Youngblood said Thursday.
Classes were canceled for Friday, the school website said, and on-campus counseling was being made available for students in the morning.
The wounded student was in critical but stable condition Thursday night, and the shooter was in custody, police said. The youth will be charged as a juvenile with attempted murder, according to Youngblood, who added that prosecutors will decide whether he should be charged as an adult.
The name of the student in custody was not released. Authorities searched his home, according to sheriff's spokesman Ray Pruitt.
Heber, who teaches science, is known as a well-liked teacher at the school, KGET reported. He is himself a graduate of Taft, where he played football and served as student body president.
"They offered him counseling at school," Heber's father, David Heber, told KGET. "He said, 'I can handle it.' So that's the type of person he is."
David Heber also said his son had been hit in the head with a shot pellet, but was fine and didn't seek treatment for it. "My son's gonna be all right," David Heber said. "The other students are the ones that probably are going to be affected the most."
Nonetheless, Ryan Heber will be coping mentally with a difficult situation, his father told KGET. In the coming days, the Heber family will be gathering to lend him their emotional support.
The Taft shooting is the latest incident of gun violence that launched a fiery national debate over whether teachers should be armed.
Last month the National Rifle Association called on communities to arm teachers or place armed guards in schools as a solution following a Newtown, Connecticut, shooting spree in which a 20-year-old gunman killed seven adults and 20 children at an elementary school.
"The only thing that stops a bad guy with a gun is a good guy with a gun," said the NRA's Wayne LaPierre. The idea has been rejected by teacher's groups and mayors, including New York's Michael Bloomberg, Boston's Thomas Menino and Philadelphia's Michael Nutter.
The debate prompted CNN commenter Adika to weigh in Thursday, saying, "So let me get this straight. The NRA wants to have police officers in schools ... yet an unarmed teacher talked a student into surrendering his gun. Besides being one heck of a hero, that teacher just might have some advice for the NRA."
Another CNN commenter, Frank455444, countered: "Well if the schools are armed and another nut shows up HE GETS SHOT! PROBLEM SOLVED!"
In Utah it's been legal for a dozen years for teachers to be armed in class. Since the law took effect, there have been no school shootings in the state, nor accidents or incidents involving educators' firearms.
Immediately after the Taft shooting Thursday, amid the frenzy of desperate parents coming to the school to retrieve their children, parents expressed concern about school security.
"It just goes to show you that we're going to have to do a lot more to protect our students in this small town," an unidentified parent told KGET. "It might be a small environment, but there's always that one bad apple."
CNN's Michael Martinez, Kate Bolduan, Steve Brusk and Kyung Lah contributed to this report.