A 45-year-old man in an apparent child custody dispute was the suspected shooter at a shelter for mothers and children in northern Germany that left six dead on Monday, officials said.
The man had an appointment at the shelter in Stade, close to the port city of Hamburg, earlier on Monday before opening fire midday, they said.
All the victims - four women and two men - were employees of the facility. The man's three-month-old daughter and the mother are safe.
The alleged shooter, the mother, and another female are in custody, officials said.
"I'm deeply shocked by the extent of violence in a place that is meant to provide protection," said German President Frank-Walter Steinmeier.
Police had warned people to stay away from the area where the incident took place, but later said there was no danger to the general public.
Police cordoned off the area near the facility in a cobbled street with red brick homes, and forensic experts in white suits and plainclothes police were at the scene. Police were still collecting evidence on Monday evening.
Five of the victims died at the scene. The sixth died in hospital.
Footage released by the Bild newspaper showed police surrounding and detaining two people from a car that was driving down a road with a flat tyre.
The suspected shooter lives in the Hannover area, was born in Germany and has Turkish roots, officials said.

US targets three Iranian oil vessels after attack on Navy ships
Israel launches strikes on southern Lebanon
Indonesia's Anak Krakatau eruption halts flights, schools, fishing
Putin says US-Russia contacts beneficial as talks begin with Witkoff and Kushner
Chinese national rescued from Nepal tunnel 10 days after flash flood
US envoys Witkoff, Kushner arrive in Moscow for talks on peace in Ukraine
One dead, 11 people missing after mudslide in China's Jiangxi province
Philippine VP Duterte posts bail after arrest order for alleged grave threats
