BERLIN (AP) — A man accused of driving into a school group in Berlin, killing a teacher and leaving others injured, appears to have a history of mental illness, prosecutors said Thursday, adding that there was no sign of a terrorist motive for what appeared to have been a deliberate act.

A court ordered the man placed in a secure psychiatric hospital. He faces preliminary charges of murder and 17 counts of attempted murder, prosecutors said.

However a spokesman for the prosecutors office, Sebastian Buechner, said it’s not clear whether the suspect could be held criminally responsible.

Investigators found medicines when they searched the man’s apartment, and “a great deal speaks for paranoid schizophrenia” as the suspect’s diagnosis, Buechner told reporters. “What there isn’t is indications of any kind of terrorist background.”

Police also found two hand-written placards with “a very general reference” to the long-running dispute between Armenia and Azerbaijan over the Nagorno-Karabakh region, but they appeared to be unrelated to Wednesday’s incident in the center of Germany’s capital, Buechner said.

Witnesses and police said a car drove into pedestrians on a popular shopping street in Berlin. A teacher with the school group from central Germany died, and nine people suffered serious injuries. In all, 31 people were injured, 14 of them students.

Police identified the suspect as a 29-year-old German-Armenian who lives in Berlin. They said he was driving his sister’s car and that passerby detained him after he crashed to a halt in a shop window.

Berlin Mayor Franziska Giffey said that, by Wednesday evening, authorities had determined that it was an “amok act by a really seriously psychologically impaired person.” She told public broadcaster RBB Inforadio that investigators were “trying … to find out more from the partially confused statements he is making.”

Berlin’s top security official, Iris Spranger, told the state legislature that the suspect obtained German citizenship in 2015 and apparently had “psychological problems” in the past. He was known to police because of proceedings for suspected bodily harm, trespassing and slander, but not for political or other extremism, she added.

The car plowed into pedestrians close to the site of a 2016 attack in which an Islamic extremist drove a commandeered truck into a Christmas market, resulting in 13 deaths. Giffey said Wednesday’s crash “reopens deep wounds and traumas” associated with that event.

The regional government in central Hesse state said the students who were hit attended 10th-grade — ages roughly 15-17 in Germany — in the town of Bad Arolsen.

State governor Boris Rhein, visiting the town on Thursday, said the students had been on a final-year trip. He said 17 members of the group had been brought home.