Updated

A student who opened fire in a hallway at a Washington state high school killed a classmate who confronted him Wednesday and wounded three others before being stopped by a custodian, authorities said.

The suspect, who a classmate described as being obsessed with previous school shootings, was taken into custody. The wounded victims were seriously injured but expected to survive, officials said.

The shooter brought two weapons to Freeman High School in Rockford, south of Spokane, but the first one he tried to fire jammed, Spokane County Sheriff Ozzie Knezovich told reporters.

"He went to his next weapon," Knezovich said. "A student walked up to him, engaged him, and that student was shot. That student did not survive."

The sheriff said the shooter fired more rounds down the hallway, striking the other students, before a school custodian approached the shooter and ordered him to surrender, Knezovich said.

Knezovich called it a courageous act that prevented further bloodshed.

The sheriff said a deputy who works as a school resource officer arrived shortly thereafter and took the shooter into custody.

Elisa Vigil, a 14-year-old freshman, told The Associated Press that she saw one male student shot in the head who janitors covered with a cloth and another female student wounded in the back.

Michael Harper, a 15-year-old sophomore, said the suspect had brought notes in the beginning of the school year, saying he was going to do "something stupid" and might get killed or jailed. Some students alerted counselors, the teen told AP, but it wasn't clear what school officials did in response.

A call to the school was not immediately returned.

Harper said the shooter had many friends and was not bullied, calling him "nice and funny and weird" and a huge fan of the TV show "Breaking Bad." He also said the suspect was obsessed with other school shootings.

Students say the shooter was armed with a pistol and rifle and had carried a duffel bag to school. After shots were fired, students went running and screaming down the hallways, Harper said.

Authorities didn't release the suspect's identity or a possible motive. The victims also were not named.

Luis Prito, an assistant football coach at Freeman High, called the shooting devastating. A vigil took place Wednesday evening at a nearby church.

"This is a real close-knit community," he said.

A two-lane road into the town of about 500 people near the Idaho border was clogged as worried parents sped to the school. Some people abandoned their cars on the street to make it to their children.

Cheryl Moser said her son, a freshman, called her from a classroom after hearing shots fired.

"He called me and said, 'Mom, there are gunshots.' He sounded so scared. I've never heard him like that," Moser told The Spokesman-Review newspaper. "You never think about something happening like this at a small school."

Providence Sacred Heart Medical Center and Children's Hospital received three pediatric patients, spokeswoman Nicole Stewart said. They were in stable condition and surrounded by family, she said.

Stephanie Lutje told AP she was relieved to hear her son was safe after his high school near Freeman High was put on lockdown. She commended the school district for its communication.

"It's been amazing, within probably 15-20 minutes of hearing about it, I'd already received a phone call, I'd already received a text message saying that their school is OK," she said.

She still worried for others she knew, including a co-worker who had yet to hear from her son, a sophomore at Freeman.

"My stomach's in knots right now," she said.

Gov. Jay Inslee said in a statement that "all Washingtonians are thinking of the victims and their families, and are grateful for the service of school staff and first responders working to keep our students safe."

___

Associated Press writers Rebecca Boone in Boise, Idaho, and Alina Hartounian in Phoenix contributed to this story.

___

A previous version of this story spelled the sheriff's name inaccurately in two references. The story has been corrected.