Paramedics transport a student wounded during the shooting at Taft High School. (AP)

Parent wait to pick up their kids outside of Taft High School. (karlhargestam via Instagram)

(Google Earth)

The young gunman who opened fire inside a California high school Thursday believed he had been bullied for more than a year, before snapping and blasting his alleged tormentor, authorities said.

The 16-year-old shooter walked into a first-period science class at Taft High School, and fired a 12-gauge shotgun into the victim, Kern County authorities said. He allegedly fired at another potential victim but missed.

“Our 16-year-old student, suspect has felt like he’s been bullied for some time by a couple students. Last night he planned the event that occurred today,” Sheriff Donny Youngblood said.

“Certainly he believed the two people he targeted had bullied him, in his mind.”

The boy swiped his brother’s shotgun and was caught on security video sneaking into campus through a side door, trying to conceal the firearm, Youngblood said.

Trish Montes, a neighbor of the juvenile gunman, said he was “a short guy,” who was teased by classmates like his victim.

“Maybe people will learn not to bully people,” the sympathetic neighbor said. “I hate to be crappy about it, but that kid was bullying him.”

Authorities praised the heroic work of fearless science teacher Ryan Heber who remarkably talked the gunman into surrendering.

By simply talking to the shooter, Heber bought time for terrified students to escape and for a school counselor to join the tense talks, authorities said.

Some students took off through a back door, while others locked themselves in a closet, according to the sheriff.

“This teacher and this counselor stood there not knowing whether he was going to turn the shotgun on them,” Youngblood said.

“They gave students a chance to escape. Whatever they said compelled him to put the firearm down.”

Taft police chief Ed Whiting said the teacher and campus supervisor put the students’ welfare ahead of their own safety.

“ We really want to really commend the teacher and campus supervisor for all they did to bring this to a very quick resolution,” Whiting said.

“They did a great job in protecting the kids and we can’t thank them enough for what they did today.”

The teacher told cops that between two and four shots were fired.

The shooter, who had 20 shotgun rounds in his pockets, told the heroic teacher during those harrowing moments, “I don’t want to shoot you,” according to authorities.

“They knew not to let him leave that classroom with that shotgun and they took on that responsibility very seriously,” Youngblood said of the two heroic educators.

The wounded student was airlifted to Kern Medical Center in neighboring Bakersfield, and is in critical but stable condition, officials said.

“He has a ways to go, more operations,” the boy’s surgeon Dr. Ruby Skinner told KERO-TV. “But I think he’s going to be able to recover.”

The teacher suffered a minor pellet wound to the head but didn’t need to be hospitalized.

Two other students were hurt in the attack — a girl with possible hearing damage when the shotgun was fired near her ear, and another young lady who fell hard while bolting from gunfire, authorities said.

One student in that class called her mom after dialing 911 and initially reported: “My friend’s been shot, my teacher has been shot,” according to KERO. The wounded student was found lying in a pool of blood, according to the mom.

The campus went on lockdown shortly after the 9 a.m. attack, and it took hours for cops to clear out terrified, hiding students, officials said.

A Taft police officer is usually assigned to the school but was not there today because he was snowed in, officials said.

Schools Superintendent Bill McDermott said school will be closed tomorrow but counselors will be available for students and staff.

Classes will resume Monday, according to McDermott, who believed this was the first shooting at the school.

This shooting comes less than a month after the Newtown, Conn. school massacre where gunman Adam Lanza slaughtered 20 young students and six educators before taking his own life.

“This is such a gut-wrenching and emotional situation when you have a place where people are trying to learn and get along … my heart went out to the folks in Connecticut,” McDermott said.

“We are very lucky in the fact that we do have a police officer on campus who is armed. Unfortunately they can’t be in every place at all times.”

Taft is a community of about 7,000 residents, some 120 miles northwest of Los Angeles. The school has an enrollment of 900 kids, ninth through 12th grades.

News of the shooting broke as Vice President Joe Biden held an event to announce his task force would make new gun-control proposals next week.

US Sen. Dianne Feinstein (D-California), author of the nation’s first assault weapons ban, revealed that her dad is a Taft HS alum.

“Today comes word of another tragic shooting at an American school. I have visited this school over the years—in fact, my own father attended Taft Union,” she said.

“At this moment my thoughts and prayers are with the victims, and I wish them a speedy recovery. But how many more shootings must there be in America before we come to the realization that guns and grievances do not belong together?”