SALEM, Mass. (AP) — A Salem State University student charged with stabbing a professor in a campus bathroom multiple times has been ordered by a judge to undergo a psychiatric evaluation.

Stephen Chastain was sent to Bridgewater State Hospital during a court hearing Thursday at which he pleaded not guilty. A court psychologist said she does not believe he is competent.

The 24-year-old biology major faces charges including attempted murder for allegedly stabbing English professor Pierre Walker 23 to 30 times in the neck, chest, arm and hands Wednesday.

Prosecutors say the men did not know each other and the attack was unprovoked. Walker is expected to recover.

Chastain told investigators that he had a history of mental illness and stopped taking his medications, had taken drugs and had no slept for five days.