At least five students were critically wounded, including a boy whose liver was pierced by a knife thrust that narrowly missed his heart and aorta, doctors said. Others also suffered deep abdominal puncture wounds.
The rampage which came after decades in which US schools geared much of their emergency planning toward mass shootings, not stabbings, set off a screaming stampede, left blood on the floor and walls, and brought teachers rushing to help the victims.
The suspect, Alex Hribal, was taken into custody and treated for a minor hand wound, then was brought into court in shackles and a hospital gown and charged with four counts of attempted homicide and 21 counts of aggravated assault. He was jailed without bail, and authorities said he would be prosecuted as an adult.
At the brief hearing, District Attorney John Peck said that after he was seized, Hribal made comments suggesting he wanted to die.
Defence attorney Patrick Thomassey described him as a good student who got along with others, and asked for a psychiatric examination.