German authorities have arrested a man who is suspected of carrying out a knife attack that left multiple people dead.

According to Reuters, the incident occurred at around 5 p.m. local time Friday in the southern German city of Wuerzburg. Law enforcement say the armed man carried out the attack in Barbarossa Square, where he fatally stabbed three civilians and seriously injured five others. The names of the victims have not been released, but several outlets report that a young boy and one of his parents were among those killed.

Videos shared on social media showed a seemingly barefoot man in the middle of the street holding a knife while being confronted by pedestrians and law enforcement. Officers managed to stop the spree by shooting the suspect in the thigh. He is reportedly being treated at the hospital for non-life-threatening injuries. The assailant has been identified as a 24-year-old Somali immigrant who had lived in the town since 2015. Authorities say the man was known to police, and was treated at a psychiatric institution in recent days. 

“His condition had been noticed in recent months, including violent tendencies, and a few days ago he was put into compulsory psychiatric treatment,” said regional Interior Minister Joachim Herrmann, who later addressed the reports that the suspect at shouted “Allahu akbar” (“God is great”) before his stabbing spree. “That suggests a possible Islamist motive, and that is also part of the investigation.”

Authorities said it appears the suspect acted alone and that there is no longer a threat. Wuerzburg is located between Munich and Frankfurt and has a population of about 130,000.