Investigators in Germany are looking into the motive behind a knife attack which left three people dead and five more injured. The incident happened in the city of Wuerzburg on Friday. Police say two of those in hospital remain in a life-threatening condition. No details of the victims have yet been released. The suspect, a <a href="https://www.thenationalnews.com/world/europe/three-killed-in-knife-attack-in-germany-1.1248866">24-year-old Somali, was shot in the leg by police</a> and was arrested on Friday. The man had lived in Wuerzburg since 2015, most recently in a shelter for the homeless. Michael Dauber, whose shop is near the scene of the attack, said he saw people running away in panic. “It was unclear for a long time what was happening, then they all started screaming that somebody is stabbing people,” Mr Dauber said. “It was totally crazy.” Videos posted on social media showed people surrounding the attacker and trying to hold him at bay with chairs and sticks. “I was particularly impressed by the dedication of many people who tried to stop the perpetrator and tried to keep him in check,” Bavarian governor Markus Soeder said. “That was really impressive dedication.” He said the police were now searching for a motive behind the attack. “Now the circumstances have to be cleared up, the motives,” he said. Bavaria's top security official, Joachim Herrmann, said the suspect had been known to police and had been admitted to a psychiatric unit a few days earlier. He said investigators had not ruled out a terrorist motive after the attacker was allegedly heard shouting “Allahu Akbar" during the assaults. "That suggests a possible Islamist motive, and that is also part of the investigation," Mr Herrman said. A police spokesman said that, while the attacker had a criminal record, none of his previous offences were related to terrorism. People have laid flowers and candles at the scene of the attack. “All of Bavaria is in mourning today,” said Mr Soeder, who added that he would order flags flown at half-mast in the state.