(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 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, 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 — and then, instead of running for his own life, 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 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 convinced 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 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 — on a day that the school personnel just happened to discuss earlier in the morning 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.

The wounded victim was airlifted to a hospital in Bakersfield, Pruitt said.

Authorities were still in the process of 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.”

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.