(CNN) -- A 16-year-old student who blasted a California high school classroom with a shotgun Thursday was targeting two classmates because he felt he'd been bullied, the local sheriff said Thursday night.
One student was hit and was in critical but stable condition Thursday night, and the shooter was in custody after a teacher and the school's campus supervisor talked him into putting his shotgun down.
Kern County Sheriff Donny Youngblood said he did not know whether bullying had actually occurred between the Taft Union High School students.
"But certainly, (the shooter) believed that the two people he had targeted had bullied him," Youngblood said at an evening news conference in Taft, about 30 miles from Bakersfield.
The young shooter was still being interrogated Thursday evening, Youngblood said, adding that the youth will be charged as a juvenile with attempted murder. It will be up to prosecutors to decide whether he should be charged as an adult, the sheriff said.
The name of the student in custody was not released.
Youngblood laid out a detailed scenario of the hours before the shooting, saying the student planned the assault the night before and took a shotgun belonging to his brother.
The student did not show up for school on time Thursday, Youngblood said, instead appearing about halfway through the first period of classes. He was caught on school surveillance cameras, the sheriff said, using a side entrance instead of the school's main door and "appearing nervous" as he tried to conceal the shotgun when he entered the school.
The gunman fired directly at one student, who was hit, and then as students rushed to flee, the gunman fired again, Youngblood said.
"Miraculously, (the second shot) didn't injure anyone."
Youngblood credited the teacher and the campus supervisor -- a campus monitor on the school's staff -- with bravely facing off with the young gunman. Youngblood identified the teacher as Ryan Heber and the campus supervisor as Kim Lee Fields.
"They stood there face-to-face (with the gunman), not knowing whether he's going to turn that shotgun on them," Youngblood said.
The assailant's pockets were "filled" with ammunition, Youngblood said, adding that he did not have an exact account of how many shotgun cartridges were recovered.
In addition to the wounded student, who was being treated in a Bakersfield hospital, two other students -- both girls -- suffered injuries in the confusion amid the shooting, Youngblood said. One girl apparently close to the shotgun blast was taken to a hospital with hearing damage, authorities said. The second girl received minor injuries trying to flee, authorities said.
The teacher suffered a pellet wound to the head from one of the shots fired earlier, authorities said.
Earlier Thursday, Youngblood said the teacher and campus supervisor "engaged in a conversation that talked him into putting that shotgun down. ... (The student) said, 'I wasn't aiming at you,' and said the name of the student he was aiming at."
Added Taft Police Chief Ed Whiting, "We commend the teacher and campus supervisor for all they did to bring this to a quick resolution before anybody else was harmed."
An armed police officer is assigned to the school, but he wasn't at the school at the time of the shooting because snowfall in the area prevented his arrival, authorities said.
Investigators recovered a shotgun they believe was used in the incident, said Ray Pruitt of the Kern County Sheriff's Office.
Authorities were still searching and securing the school Thursday evening. Investigators also were searching student backpacks to ensure no additional firearms were in the school, Youngblood said.
Tia Savea, who lives across the street from Taft's science building, said she saw a youth, about 15 or 16 years of age, walk by her window with a gun shortly before the shooting.
She thought the gun was a toy, she said.
The youth walked into the school, and Savea heard two distinct shots, she said. Her son is a 10th-grader at the high school, she said.
Classes are canceled for Friday, and the school is scheduled to reopen, with additional counselors, on Monday, officials said.
U.S. Rep. Kevin McCarthy expressed sympathies to the Taft community, which is in his district.
"I am deeply saddened and troubled by news of the shooting," the Republican lawmaker said.
U.S. Sen. Dianne Feinstein, D-California, said her father attended Taft Union High, which she has visited over the years.
"Today comes word of another tragic shooting at an American school," Feinstein 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?" Feinstein asked.
CNN's Kate Bolduan, Steve Brusk and Kyung Lah contributed to this report.