A student has opened fire at a school in the United States, killing one and injuring several others before taking his own life, police and media reports said.

The shooting happened on Friday in the cafeteria of Pilchuck school in Marysville, 55km north of Seattle in Washington State.

Three students were taken to hospital in critical condition, a doctor told the AFP news agency, while a police spokesman said he was confident that there was only one shooter and that he was dead.

Police said the attacker and one of his victims were dead. It was not clear if the victim was one of the three critically injured.

One student in the cafeteria, named only as Alex, told a local news channel: "I was eating... I heard four gunshots and it was behind me. I saw a gun pointed at a table... then I ran out of the exit."

A student identified as Austin told CNN how the gunman was sitting with his victims before he pulled the gun.

"There was just a big group of kids... He was just sitting there. Everyone was talking. All of a sudden I see him stand up, pull something out of his pocket," he said.

"At first I thought it was just someone making a really loud noise with like a bag, like a pretty loud pop until I heard four more after that, and I saw three kids just fall from the table like they were falling to the ground dead."

Adam Holston, 14, told the same channel" "Everyone just started running. I could hear the gunshots and my heart was racing and we didn't know what was going on," he said.

Source: Al Jazeera and agencies