ROCKFORD, Wash. — A student who opened fire in a hallway at a Spokane-area high school killed a classmate who confronted him Wednesday and wounded three others before being stopped by a staff member, authorities said.

The suspect, who a classmate described as being obsessed with previous school shootings, was taken into custody. The wounded victims were 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."

BREAKING: Terrifying firsthand account from a student who was inside #FreemanHS when the shooting began. @KHQLocalNews pic.twitter.com/PmXjtHRqlJ — Patrick Erickson KHQ (@patrickerickson) September 13, 2017

The sheriff said the shooter fired more rounds down the hallway, striking the other students, before a school staffer stopped him. Knezovich called it a courageous act that prevented further bloodshed.

Elisa Vigil, a 14-year-old freshman, told The Associated Press that she saw a 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 was unclear 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, called the shooting devastating.

"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."

At Freeman elementary currently. I am a junior, evacuated from the high school. At least 4 shots. pic.twitter.com/RnGbbbahbK — christina (@TheChristinaXX) September 13, 2017

And U.S. Sen. Patty Murray tweeted:

Heartbreaking headlines out of Spokane county. My thoughts are w/ students, teachers, parents, 1st responders & the entire community. -PM — Senator Patty Murray (@PattyMurray) September 13, 2017

This story will be updated as details become available.

-- The Associated Press

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 the AP she was relieved to hear her son was safe after his high school near Freeman was put on lockdown. She commended the school district for its communication.

"It's been amazing, within probably 15 to 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."