A 33-year-old man arrested on suspicion of fatally stabbing two teenagers and injuring five other passengers on a train in northern Germany had been released from pretrial detention a week ago and had previous criminal convictions, investigating officials said Thursday.

The man, who was identified as Ibrahim A., a stateless Palestinian who came to Germany in 2014, allegedly stabbed multiple people Wednesday afternoon on a regional train traveling from Kiel to Hamburg. A 17-year-old girl and a 19-year-old man died of their wounds, authorities said.

Two victims were still in life-threatening condition and two others were severely injured. One person was slightly injured, police said.

Other passengers overwhelmed the suspect, who was treated at a hospital for slight injuries and is in police custody, local police said at a press conference in Kiel.

GERMAN DEFENDANT SAYS HELLS ANGELS LEFT MALLORCA IN 2011

Police and prosecutors said that the suspect’s criminal record included convictions including for another stabbing incident, sexual assault, grievous bodily harm, and shoplifting. German dpa agency said he had been in pretrial custody for a year because of another knife crime in Hamburg, before being released a week ago.

Before he was registered in Kiel, the suspect also lived in Hamburg and in the western state of North Rhine-Westphalia.

Police and prosecutors were investigating possible motives for the attack, which happened as the train approached the town of Brokstedt.

German train attack

Deutsche Bahn security guards stand on the platform at Brokstedt station at dawn in Brokstedt, Germany, on Jan.26, 2023

Several media outlets reported that the attacker chased passengers through different coaches of the train and that traces of blood could be found in four of them. Some passengers tried to defend themselves by throwing their suitcases at him, German news channel n-tv reported.

Sabine Suetterlin-Waack, the interior minister of Schleswig-Holstein state, where Brokstedt is located, said the parents of the two teenage victims had been informed of their deaths. Not all other injured victims had been identified by Thursday noon time, she said.

"Due to the very dynamic course of the crime, much is unclear," the minister said. Results of an interrogation of the alleged perpetrator did not exist yet, so investigators cannot yet say anything about the motive.

CLICK HERE TO GET THE FOX NEWS APP

She said investigators were working under high pressure to "gather all the facts."

The state parliament began its session Thursday with a minute of silence for the victims of the attack.