“The attacker was overpowered after the police used firearms,” the authorities said on Twitter, without giving details of the suspect’s motives.
“There are three dead, five seriously injured and others injured,” said Bavaria’s interior minister Joachim Herrmann, adding, “it was not certain if the most seriously injured will survive”.
The 24-year-old suspect has lived in Würzburg since 2015, he said.
(article continues below)
See also on The Local:
Investigators have found documentation showing the man “was treated in a psychiatric institution”, said Herrmann, but added that he could not detail the length of the stay.
“The police investigation will determine if this was an Islamist act or if it was due to the psychiatric state” of the man, he said.
The suspect staged the attack in the city centre at around 5pm, striking at a household goods store, before hitting a bank.
Police were able to arrest the man after shooting him in the leg, said Herrmann.
The mass-circulation daily Bild published a photo of the suspect, showing a man wearing a beige, long-sleeved t-shirt with grey trousers and holding a long knife.
Video footage circulating online also showed passers-by trying to stop the suspect using folded chairs.
A crowd of people gave chase before a police car arrived on the scene, one video showed.
Another photo published by Bild showed a police officer handcuffing the suspect.
A huge police deployment was underway in the city of some 130,000 inhabitants located about 120 kilometres (75 miles) west of Frankfurt.
While the perpetrator’s motive has not yet been established, Germany has been on high alert after several deadly Islamist extremist attacks.
Würzburg was itself hit five years ago by an axe-wielding man who seriously wounded four people in a train.
The suspect, an Afghan, sought to attack a passerby as he fled before being shot dead by police.
The attack was claimed by the Islamic State (IS) jihadist group.
The deadliest Islamist attack in Germany happened in December 2016 when a jihadist rammed a truck into Berlin Christmas market killing 12 people.
The Tunisian attacker, a failed asylum seeker, was an IS supporter.
More recently, one man was killed and another seriously injured in a knife attack in the city of Dresden in October.
A 20-year-old Syrian jihadist in May received a life sentence for the homophobic attack.
Last August, six people were injured in a series of motorway accidents in Berlin in what prosecutors described as a suspected Islamist attack.
Since 2009, German authorities have foiled 17 suspected jihadist attacks – the majority in 2016, according to the interior ministry.
The number of Islamists considered dangerous in Germany rose sharply between 2015 and 2018, according to security services.
But the numbers have declined since then, with 615 considered dangerous by the latest count compared with 730 in January 2018.
There are also 521 people “who have attracted the attention of the security services but have not yet reached the stage of being considered dangerous”.
In 2020, 320 new investigations with a link to the Islamist threat were launched in Germany.
Germany remains a target for jihadist groups, in particular because of its involvement in the coalition fighting IS in Iraq and Syria, and its deployment in Afghanistan since 2001.
The far-right Alternative for Germany (AfD) party has meanwhile charged that Chancellor Angela Merkel’s decision to allow in more than one million asylum seekers – many fleeing Iraq and Syria – since 2015 has contributed to the heightened security risk.
But beyond Islamist attacks, there have been other knife assaults.
In October 2017, a man randomly attacked passers-by with a knife in central Munich, lightly injuring eight people. Police excluded terrorism as a motive after detaining a suspect.