Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Washington State high school "homecoming prince" opened fire in the cafeteria Friday, killing a girl and wounding four other people before fatally shooting himself, police and witnesses said.

A hospital official said three patients were in "very critical condition" with head wounds after the shooting at Marysville Pilchuck High School about 10:30 a.m. (1:30 p.m. ET). Two of them were later taken to a Seattle hospital, including a 15-year-old boy who remained in critical condition. Police said all of the wounded were under the age of 18.

Police said the shooter, whom law enforcement sources identified as freshman Jaylen Ray Fryberg, died of a self-inflicted gunshot wound. Classmates described him as popular, and just last week, he was crowned homecoming prince at a football game.

The motive for the shooting was unclear, although Fryberg posted a series of tweets that suggested a rocky romance. Students said he wore a blank stare as he silently began shooting, turning an ordinary lunch period into a tableau of terror and tragedy.

"Just all of a sudden, I see him stand up, pull something out of his pocket," Austin Taylor, who had just finished eating lunch at the next table, told NBC station KING of Seattle.

Taylor said he heard one loud pop, then four more after that.

"I saw three kids just fall from the table like they were falling to the ground dead," he said.

As the killer fiddled with the small pistol — a .40-caliber Beretta, according to law enforcement sources — Taylor ran from the cafeteria and into a classroom.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"He had a blank stare," Taylor said. "He was just staring at the victims as he shot them.

"He was just calm during the whole thing, and he was perfectly fine the day before. Everyone knew him. ... He was always a very nice kid."

Another student, Alan Perez, said he also saw Fryberg pull out his weapon.

"I just dropped my skateboard and ran as fast as I could," told KING. "I saw he had a little gun in his hand and saw the flash from the muzzle of the gun."

A junior, Erick Cervantes, told NBC News that a woman in the cafeteria, possibly a teacher, rushed to intervene and grabbed Fryberg's arm. He said the gunman tried to fire at the woman but ended up shooting himself in the neck.

People wait at a church where students were taken to be reunited with parents following a shooting Friday at Marysville Pilchuck High School in Marysville, Washington. Ted S. Warren / AP

After the shooting, someone pulled the fire alarm, and students rushed out of classrooms, only to be ushered back in by staff as the building was placed on lockdown.

Cindy Rodriguez, 17, told NBC News that as she hunkered down in a classroom with about 40 other teens, she texted her kid brother, who was in the lunchroom.

"I wanted to make sure he was OK. He told me a freshman brought a gun to school and he shot four people," she said.

"He was just staring at the students as he shot them."

The gunman was down within four minutes of the initial anonymous call to 911, Marysville police Cmdr. Robb Lamoreux said. Doug Dawson, special agent in charge of the Seattle office of the federal Bureau of Alcohol, Tobacco, Firearms and Explosives, said his weapon had been legally acquired.

The school will be closed next week, said Becky Cooke Berg, superintendent of the Marysville School District. "We are indeed heartsick," she said.

All extracurricular activities were canceled across the district this weekend, she said, including Marysville Pilchuck's football game Friday night against Oak Harbor High School, which offered to accept second place, Berg said.

As moms and dads were reunited with their kids at a church, doctors were working to save the wounded.

The four patients were initially taken to Providence Regional Medical Center in Everett. The 15-year-old boy and a second boy, age 14, were taken to Harborview Medical Center in Seattle in the afternoon.

Lamoureux said the motive was not known, but Fryberg had posted a series of emotional tweets in recent days:

It breaks me... It actually does... I know it seems like I'm sweating it off... But I'm not.. And I never will be able to... — Jaylen Fryberg (@frybergj) October 21, 2014

It won't last.... It'll never last.... — Jaylen Fryberg (@frybergj) October 23, 2014

A spokesperson from the FBI's Seattle office said agents were on their way to the scene, about 35 miles north of Seattle.

Hallie Jackson, M. Alex Johnson, Michael Kosnar and Emmanuelle Saliba of NBC News and Sofia Jaramillo contributed to this report.