Three people were killed and five wounded in a stabbing attack in the German town of Wuerzburg on Friday.
The suspected perpetrator, identified as a 24-year-old Somali man living in the city, was shot in the leg by police and arrested, officials said. Police added that his life was not in danger from his gunshot wound.
Bavaria’s top security official Joachim Herrmann said the injured include a young boy, whose father was probably among the dead.
The suspect was in psychiatric treatment before the attack and had been known to police, Mr Herrmann said. There was no immediate word on a possible motive.
“The events took place in the middle of Wuerzburg’s city centre, in one of the city’s most bustling squares. Thanks to the courageous efforts of customers of the department store and passers-by, as well as the incredibly fast arrival of the police, further acts of violence could be prevented,” said the city's mayor, Christian Schuchardt.
The situation is now under control, police said.
"The attacker was overpowered after police used a firearm," Lower Franconia police said on Twitter. "There are no indications of a second suspect. There is no danger to the population."
Videos posted on social media show a young man seemingly holding a knife who was being warded off by other men holding chairs until police arrived. Another video appeared to show blood on the ground.
The videos matched the reported location of the attacks on and around Wuerzburg's central Barbarossaplatz, though it was not immediately possible to confirm when they had been made.
Wuerzburg is a city of some 130,000 people south-east of Frankfurt.