Three people have been killed and five seriously injured in a knife attack in the German city of Wuerzburg, police and a regional government minister said.

Iran PressEurope: The suspect, a 24-year-old Somalian man who lives in Wuerzburg, was shot and injured by officers.

"The attacker was overpowered after the police used firearms," said police on Twitter.

"As things stand, three are dead and five very seriously injured," regional interior minister Joachim Herrmann said after arriving at the scene. "With the most seriously injured we are not sure they will survive."

Police said they had arrested the attacker after a "major operation" in which parts of the city centre were sealed off.

"We have arrested a suspect," Lower Franconia police said on Twitter.

"There are no indications of a second suspect. There is no danger to the population."

The suspect was recently held in a psychiatric institution, Bavaria's interior minister said.

Investigators have found documentation showing the man "was treated in a psychiatric institution", said Joachim Herrmann, but added that he could not give details on the length of the stay.

Wuerzburg is a city of some 130,000 people south-east of Frankfurt.