BERLIN - German authorities say a man armed with a long knife killed three people and injured several others, some seriously, in the southern city of Wuerzburg before being shot by police and arrested.

It was unclear how many people were were injured in the attack in a central part of the Bavarian city.

Police identified the suspect as a 24-year-old Somali man living in Wuerzburg.

His life was not in danger from his gunshot wound, they said.

Videos posted on social media showed pedestrians surrounding the attacker and holding him at bay with chairs and sticks.

Bavaria's top security official, Joachim Herrmann, was on his way to Wurzburg, a city of about 130,000 people located between Munich and Frankfurt.