(CNN) -- The 16-year-old student showed up late to class armed with a 12-gauge shotgun.
With the first period half over, the student took direct aim and hit one classmate in the 28-student classroom in the science building of Taft Union High School in Taft, California, authorities said.
The gunman then aimed specifically at another classmate but missed, authorities said.
"There was some conversation about bullying, but we have not confirmed that that is an issue at this point," Kern County Sheriff Donny Youngblood told reporters in trying to explain the motivation of Thursday's school shooting in Taft, about 30 miles west of Bakersfield, California.
"But obviously something occurred that led the student to come in with a shotgun," the sheriff said.
The wounded student, also 16, was in critical but stable condition Thursday in a Bakersfield hospital, the sheriff said.
Two other students -- both girls -- suffered injuries in the shooting and confusion, 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 gunman was in custody Thursday after he was talked into dropping the firearm by his teacher and another school staff member, said authorities, who weren't releasing names of the gunman or the school personnel.
As the shooting unfolded, the teacher in the classroom evacuated his students out of a back door. Then, instead of running for his own life, he engaged the student gunman in a conversation, authorities said.
The teacher suffered a pellet wound to the head from one of the shots fired earlier, authorities said.
The conversation seemed to be a diversion to allow the remaining students to escape, the sheriff said.
The teacher was joined by the campus supervisor -- a campus monitor on the school's staff -- and both of them persuaded the student to drop the shotgun, the sheriff said.
"They stayed and probably distracted him and probably allowed students to get out of the classroom," Youngblood said.
"They engaged in a conversation that talked him into putting that shotgun down that had been discharged at least once," Youngblood added. "He said, 'I wasn't aiming at you,' and said the name of the student he was aiming at."
The student gunman, who was taken into custody, was found to have about 20 rounds in his pocket, Youngblood said.
The teacher and campus supervisor were described as heroes Thursday, when school personnel had coincidentally discussed earlier the campus lockdown process in case of an emergency, the interim superintendent said.
"We don't know what would have happened. This is a tragedy but not as bad as it might have been," Youngblood said.
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 afternoon. Investigators also were searching student backpacks to ensure no additional firearms were in the school, Youngblood said.
"There are still some students on campus," Pruitt said late Thursday morning. "We're still searching from building to building because we want to make sure we don't have suspects outstanding."
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 then 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 re-open, 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 said.