By Eric M. Johnson and Victoria Cavaliere

MARYSVILLE Wash. (Reuters) - A student opened fire in the cafeteria of his Washington state high school on Friday, killing a classmate and wounding at least four others before taking his own life amid the chaos of students scrambling to safety, authorities said.

All of the victims of the shooting at Marysville-Pilchuck High School were young people, and three were in critical condition with gunshot wounds to the head, said Joanne Roberts, chief of medicine at Providence Regional Medical Center in Everett.

The fourth wounded victim suffered less serious injuries in the gunfire and had been transferred to Harborview Medical Center in Seattle. A spokeswoman for that hospital said the young man was in serious condition.

Two of the wounded were male and two female, hospital officials said.

"At this point, we are confirming that there are two deceased,” Marysville Police Commander Robb Lamoureux told reporters. Marysville is about 30 miles (50 km) north of Seattle.

Police said the shooter died of a self-inflicted gunshot wound.

Authorities said they did not yet know what may have motivated the assailant and declined to release the suspect's identity.

Witnesses described the gunman as a well-liked freshman and member of the school's wrestling and football teams. They said he walked into the school's cafeteria at lunchtime and opened fire at a table of classmates.

"He came up from behind and had a gun in his hand and he fired about eight bullets into backs of them. They were his friends so it wasn't just random," student Jordan Luton told CNN, adding that the gunman fired several more shots.

"Then he turned and looked at me and my girlfriend ... and kind of gave us a smirk and turned around and then shot more bullets outside," Luton said.

Local television stations showed images of students running from school buildings, crossing a sports field with their hands in the air as officers with rifles ran across the school yard. They were taken to a nearby church by bus.

At the church, 15-year-old 10th-grader Gladis Jimenez said she heard two large pops during her fifth period class and then saw classmates frantically running.

"I heard these two big noises, and I see kids running and they looked so scared. Then the fire alarm went off and we thought it was a fire," Jimenez told Reuters. "We lined up to go the auditorium and then they said no, go back and we were just running and running back and forth."

She said she ultimately sheltered with classmates in a classroom and a student's mother told him via text message what was happening.

The violence at Marysville-Pilchuck High School marked the latest in a series of deadly rampages at American schools that have played a central role in a national debate over gun laws.

In 2012, a 20-year-old gunman entered Sandy Hook Elementary School in Newtown, Connecticut, and killed 20 children and six adults before taking his own life in one of the deadliest mass shootings in U.S. history.

(Additional reporting by Ian Simpson in Washington, D.C., Sharon Bernstein in Sacramento and Alex Dobuzinskis and Dan Whitcomb in Los Angeles; Writing by Dan Whitcomb; Editing by Mohammad Zargham)