A 16-year-old student armed with a shotgun walked into class in a rural California high school on Thursday and shot one student, fired at another but missed, and then was talked into surrendering by a teacher and another staff member, officials said.

The teen victim was in critical but stable condition, Kern County Sheriff Donny Youngblood told a press conference. The sheriff said the teacher suffered a minor pellet wound to the head but declined treatment.

When the shots were fired, the teacher began trying to get the more than two dozen students out a back door and also engaged the shooter in conversation to distract him, Youngblood said. A campus supervisor responding to a call of shots fired also began talking to him.