The shooter had brought "multiple weapons" to the small school, officials said.
One jammed as he tried to open fire, Spokane County Sheriff Ozzie Knezovich said in a news conference Wednesday.
That's when a student, identified by local media and CNN affiliates as Sam Strahan, stepped in to try to stop the shooter and save lives.
He paid his own.
"It sounds like he tried to walk up and tell him 'this isn't what you want to do,'" Sheriff Knezovich said.
Strahan was killed and three others were wounded when the shooter opened fire at Freeman High School, officials and witnesses said. The three wounded students are in stable condition at a hospital. The suspect is in custody, Knezovich said.
And Strahan is being remembered as a hero.
Student remembered as 'true hero'
Strahan died just months after he lost his father, Scott, in an accident.
Sam was a "true hero" and an "incredible soul," who was close to his father, Jennifer Guenther, a long-time friend of Strahan's sister, told the Spokesman-Review.
"Watching him grow up to be such a positive and happy spirit to others around him was inspiring," Guenther told the newspaper. "Sam was a brother who loved and cared for his older sister and always watched out for his mother."
A friend and classmate described Strahan as a fun-loving person who'd been deeply affected by the death of his father, was funny and liked to make lots of jokes. "He just lost his father this past summer. I thought he was a lot wiser (after his father died). He didn't do stuff like he used to do. But he was still funny," Liam Marshall told the Spokesman-Review.
'It was terrifying'
Witnesses described the terrifying scene that unfolded around 10 a.m.
"I heard this really loud noise, I thought someone had dropped something super heavy," Freeman junior Marcus Morphy told CNN affiliate KAYU-TV
. "Then I heard two or three more shots, that's when I realized it was a gunshot."
Morphy said he hid in a storage room next to the classroom with a friend.
"We heard a girl screaming out in the hallway, Morphy said. "I was shaking the whole time, it was terrifying." The school, which is between Spokane and Rockford, has 327 students, according to media reports.
'Senseless and tragic events'
Hundreds gathered at area churches and schools for a number of vigils in support of the victims Wednesday.
Washington Gov. Jay Inslee issued a statement shortly after the shooting.
"As Spokane County officials continue their investigation to get the answers to the questions so many of us have during these unthinkable tragedies, the Washington State Patrol and all state agencies will do whatever we can to help provide support and comfort in the days and weeks to come,"
The governor called the shooting "heartbreaking."
"These are senseless and tragic events that really don't need to happen, and I don't understand them," Sheriff Knezovich said. "I don't think anybody can make any sense out of this. But we need to figure out what's gone wrong with our society that our children decide they need to take weapons to deal with the issues they're facing."