Updated

Minutes before a gunman walked into a California high school, students and teachers had been practicing what to do if the school came under an attack.

"Just 10 minutes before it happened, our teachers were giving us protocol because of what happened in Connecticut," Oscar Nuno, a student at Taft High School said.

A 16-year-old student armed with a shotgun walked into his first period science class Thursday and opened fire, wounding a classmate he claimed had bulled him. Video surveillance shows the suspect entering the building through a side door.

He fired two more rounds at students, reportedly missing a second target, as they fled the class, and then faced a well-liked teacher Ryan Heber, MyFoxLA.com reported.

"I don't want to shoot you," he told Heber as the teacher tried to convince the student to put down the gun.

Police credit Heber with causing enough of a distraction to allow a majority of the students to escape the classroom through a back door unharmed.

The student hit by the gunshot is in critical but stable condition and is expected to undergo surgery Friday. Three others are injured, including a student who may have suffered hearing damage after being too close to the shotgun blast, MyFoxLA.com reported.

An announcement over the speaker system said the school was under lockdown "and it was not a drill."

School officials say there is usually an armed guard on campus, but the person was absent because he was snowed in.

The suspect surrendered his shotgun to Heber and campus supervisor Kim Lee Fields. His pockets were stuffed with more ammunition, Youngblood said.

"This teacher and this counselor stood there face-to-face not knowing if he was going to shoot them," Kern County Sheriff Donny Youngblood said. "They probably expected the worst and hoped for the best, but they gave the students a chance to escape."

"The heroics of these two people goes without saying. ... They could have just as easily ... tried to get out of the classroom and left students, and they didn't," Youngblood said. "They knew not to let him leave the classroom with that shotgun."

Heber's forehead was grazed by a stray pellet, but Youngblood said the teacher who had graduated from the Taft school two decades ago was unaware he had been hit and didn't need medical attention.

"He's the nicest teacher I know," Nuno said. "He loves his students and he always wants to help."

Administrators closed the school Friday as residents of this remote town of 9,400 that sits amid tumbleweeds and oil fields about 120 miles northwest of Los Angeles tried to make sense of what happened.

"We know each other here," said former Mayor Dave Noerr. "We drive pickups and work hard and hunt and fish. This is a grassroots town. This is the last place you'd think something like this would happen."

The suspect's name is on the lips of everyone in town, but authorities aren't releasing it because he's a juvenile. He had felt bullied by the victim, who played for the Taft Wildcats football team last year, for more than a year, said Youngblood, who added that the claim was still being investigated.

Trish Montes described her neighbor as "a short guy" and "small" who was teased about his stature by many.

Montes said her son had worked at the school and tutored the boy last year.

"All I ever heard about him was good things from my son," Montes said. "He wasn't Mr. Popularity, but he was a smart kid. It's a shame. My kid said he was like a genius."

On Wednesday night the teen went home and plotted revenge against two students, Youngblood said. He found a gun that authorities believe belonged to the suspect's older brother and went to bed that night plotting revenge against two students.

"He planned the event," Youngblood said. "Certainly he believed that the two people he targeted had bullied him, in his mind. Whether that occurred or not, we don't know yet."

The teacher's father, David Heber, told the Bakersfield Californian that he had heard rumors of a school shooting but wasn't initially worried that his son's classroom would have been involved.

"His students like him a whole bunch," said Heber, 70. "He's not the kind of teacher a student would try to hurt. He's definitely someone who could talk a kid down in an emergency."

Youngblood said that the suspect would be charged with attempted murder. The district attorney will decide whether he's charged as an adult, Youngblood said.

Wilhelmina Reum, whose daughter, Alexis Singleton, is a fourth-grader at a nearby elementary school, got word of the attack while she was about 35 miles away in Bakersfield and immediately sped back to Taft.

"I just kept thinking this can't be happening in my little town," she told The Associated Press.

The attack there came less than a month after a gunman massacred 20 children and six women at Sandy Hook Elementary School in Newtown, Conn., then killed himself.

That shooting prompted President Barack Obama to promise new efforts to curb gun violence. Vice President Joe Biden, who was placed in charge of the initiative, said he would deliver new policy proposals to the president by next week.

Click for more from MyFoxLA.com

The Associated Press contributed to this report.