Three people have been killed in a knife attack by a single assailant in Wuerzburg in the southern German state of Bavaria, police said on Friday.
Five others were severely injured in the attack and it was not clear whether the victims would survive their injuries, Bavarian Interior Minister Joachim Herrmann said. There were others who had suffered lighter injuries, he said.
Herrmann confirmed that police had caught the alleged attacker by shooting him in his upper leg. He was currently being questioned by security forces in hospital, Herrmann said.
The alleged attacker was a Somali man who had been living in Wuerzburg since 2015. He had exhibited violent behaviour in recent weeks and had been committed for treatment to a psychiatric ward.
According to initial reports, the man attacked passers-by near Barbarossa square in the centre of the Bavarian city. Herrmann spoke of several locations, including a department store and a bank branch.
The police said they had received an emergency call at 5 pm, local time.
Parts of the city centre were sealed off in the afternoon and there was a large police presence.
Some users posted footage online of the attack, showing passers-by trying to surround a knife-wielding man before police arrived. The man was walking barefoot and wearing a protective mask in the video.
Passers-by tried to stop him with any means available, including one wielding a broom, some holding folded up chairs, while another man threw a bag at the attacker.
When the man tried to escape down an alley, a crowd of people followed him, shortly before a police vehicle arrived, which was shown the way by the onlookers.
The alleged attacker was caught and detained, police said. Photo: Karl-Josef Hildenbrand/dpa.
Police had asked people not to post images or videos online to respect the privacy of the victims.
There was initially no information about the motivation for the attack.
One witness of the attack said that the attacker was "extremely brutal" when stabbing his victims, and that he shouted "Allahu akbar" during the attack. This information could however not be confirmed further, Herrmann said.
"We don't have any indications about other attackers," a police spokesperson said, adding that the population was not in further danger.
Bavarian leader Markus Soeder expressed his condolences. "We grieve with the victims and families," he wrote on Twitter.
Wuerzburg is a city in Germany's southern region of Bavaria, with 127,000 inhabitants, some 100 kilometres north-east of Nuremberg.