(Reuters) - A student carrying two guns opened fire at his high school near Spokane, Washington on Wednesday, killing one classmate and injuring three others before he was apprehended by a staff member, the local sheriff said.

The slain student was trying to convince the shooter, whose first gun had jammed, not to carry out the morning rampage when he was shot dead, Spokane County Sheriff Ozzie Knezovich told reporters.

The gunman then fired on three other students in a second-floor hallway of Freeman High School in Rockford, Washington, Knezovich said. The surviving victims, who were in their mid-teens, were listed in stable condition, a local hospital said.

Knezovich declined to identify the suspect or discuss what may have motivated the gun violence in detail but said: “It sounds like a case of a bullying-type of situation.”

He said that a member of the staff at Freeman who he described as “very courageous” was able to capture the gunman before police officers arrived on scene to take him into custody. He was being held at Spokane County juvenile jail.

“Fortunately that one (gun) jammed. This would have been a lot worse if it didn’t,” Knezovich said. “These are senseless, tragic events that really don’t need to happen and I don’t really understand them.”

“But we need to figure out what’s gone wrong with our society that our children decide that they need to take weapons to deal with the issues that they’re facing,” he said.

Slideshow ( 2 images )

A freshman who witnessed the shooting told local KREM-TV that the shooter, a classmate since elementary school, stalked the hallway with a pistol and second gun, appearing calm as he fired at his victims and the ceiling.

The girl said that the suspect was an “outgoing” boy who she would not have thought capable of such violence. But she said other students had told her that he had made an ominous post about his intentions on a social media account.

Following the shooting at the school of 327 students, some parents abandoned their cars stuck in traffic and walked up to a mile to reach their children, KHQ-TV reported.

“This morning’s shooting at Freeman High School is heartbreaking. All Washingtonians are thinking of the victims and their families,” Governor Jay Inslee said on Twitter.

The United States has had an average of 52 school shooting incidents a year since a gunman killed 26 young children and educators in Newtown, Connecticut, in 2012, according to Everytown for Gun Safety, a gun-control group founded in response to that massacre.