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 to begin enforcing maritime blockade on Iran on Tuesday
Trump says US to reimpose naval blockade on Iran
Ukraine awaits new government after prime minister's shock dismissal
Bangkok pub fire kills 27, police investigating possible negligence
One killed in encounter with US immigration agents in Maine
