Media playback is unsupported on your device Media caption One official said some students suffered "significant injuries"

An attacker armed with two knives has gone on a rampage at a high school in the US state of Pennsylvania, stabbing 21 students and a security guard.

A suspect, named as Alex Hribal, 16, was arrested at Franklin Regional High School in Murrysville near Pittsburgh, police said.

He was later charged with four counts of attempted homicide and 21 counts of assault. The injured, some with serious stab wounds, were as young as 14.

All are expected to survive.

"There are a number of heroes in this day," Pennsylvania Governor Tom Corbett said in an evening news conference in Murrysville. "Many of them are students: students who stayed with their friends and didn't leave their friends."

Media playback is unsupported on your device Media caption Morris Hundley was called to collect his daughter, after receiving a frantic phone call from her

'Frantic'

Twenty people were transported to nearby hospitals after the attack. Several needed surgery for "significant" stab wounds, with damage to major organs, according to a trauma director at Forbes Hospital.

A 17-year-old patient was also on ventilator after a knife pierced his liver.

The young man will need additional surgery "but we're very hopeful that he will make it through this," Dr Lou Alarcon, a medical director at the University of Pittsburgh Medical Center, told a local broadcaster.

Image copyright AP Image caption Emergency responders converged on Franklin Regional High School following reports of a mass stabbing on Wednesday

The school will be closed for several days as investigators process the crime scene, Gennaro Piraino, superintendent of the Franklin Regional school district, said.

"Our thoughts and prayers are with the injured and all of those affected by this awful tragedy," he said.

The attack occurred as students were arriving at the school before 08:00 (12:00 GMT) on Wednesday morning.

Murrysville Police Chief Thomas Seefeld said someone, possibly a student, pulled a fire alarm after seeing the first stabbings.

The panicked students poured out of the school building, some suffering injuries in the chaos, as police arrived in search of the suspected attacker.

Police have not determined a motive, but investigators are looking into reports of a threatening phone call between the suspect and another student the night before.

Officials have credited an assistant principal at the school with subduing the suspect, who has been charged as an adult.

In an interview outside the school, Morris Hundley said his "frantic" 14-year-old daughter Morriah called him to say a friend of hers had been stabbed at the school.

"She needed me or my wife to come get her," he said. "She was just frantic, I never heard her talk like that."