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.
Heber, however, hates the term hero. He told CNN Friday that he doesn't want to be labeled anything except "teacher."
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. Heber and his wife, who also works at the school, visited the hospital Friday and met with the father of the victim.
The name of the student in custody was not released. He 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. 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, according to his father, David Heber. He is himself a graduate of Taft, where he played football and served as student body president.
David Heber wasn't surprised that his son played a key role in diffusing the situation, saying Ryan Heber makes a point of getting to know his students -- including the suspected gunman -- on a personal level.
"Because he knows the boy and the boy knows him ... I attribute that to why the boy talked and listened to my son," David Heber said. "It's all about kindness. It's all about my son being kind and caring about his students that makes this successful."
David Heber also said his son, who was standing just a few feet away from the student who was shot, had been hit in the head with a shot pellet, but was fine and didn't seek treatment for it.
Nonetheless, Ryan Heber will be coping mentally with a difficult situation, his father said, adding his son slept little Thursday night.
"This was a very upsetting incident," David Heber said, describing his son as "emotionally worn out."
"It was hard for him. ... but he's come to the conclusion that he did everything he could do."
Ryan Heber told CNN that it wasn't just his students he was worried about as he faced the gunman -- it was also his wife, who works in the business office of the school, and his two sons, ages 5 and 3, at home.
As the school went into lockdown amid the shooting, Heber's wife texted him from her office, reminding him to lock his classroom door. His response, according to his father, "The shooter is in my room."