A custodian at Freeman High School in the tiny town of Rockford, Wash., likely prevented further bloodshed as he encountered and subdued the student shooter who was firing off rounds in the school’s hallway after he had already gunned down one classmate and wounded three others.

Spokane County Sheriff Ozzie Knezovich said it was a courageous act by the school staff member and most likely a life-saving action.

“He went to his next weapon,” Kzenovich said of the 15-year-old shooter Caleb Sharpe, the Seattle Times reported. “A student walked up to him, engaged him, and that student was shot. That student did not survive.”

That student, identified by witnesses as Sam Strahan, was shot in the head and killed when he confronted Sharpe in the hallway in an attempt to try stop him before he opened fire. Two janitors were said to cover Strahan with a cloth as Sharpe made his way down the hallway. According to Kzenovich, the janitors’ actions were “a courageous act that prevented further bloodshed.”

RELATED: Eight people are dead after gunfire breaks out in a quiet Texas neighborhood

Students told authorities the shooter came to school armed with a pistol and rifle, and carried a duffel bag into the school. Michael Harper, a 15-year-old sophomore told the Associated Press that Sharpe had brought notes in the beginning of the school year, saying he was going to do “something stupid” and might get killed or jailed.

RELATED: A woman turns herself in after firing warning shots — into a homeless man

Differing from other shooters who tend to be loners or the victims of bullying, Harper said Sharpe had many friends and wasn’t bullied. He described the teen as “nice and funny and weird,” and said he is a huge fan of the TV show “Breaking Bad.”

But he also said Sharpe was obsessed with other school shootings. About a month before the attack, Sharpe posted on YouTube a bizarre video footage of himself shooting a toy gun. He added sound effects and graphics simulating gun blasts to the clip to make it appear more realistic.