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.

Trump says deal reached to disarm Hamas, Israeli support for plan remains uncertain
Sri Lanka's former police chief sentenced to death over 2019 Easter bombings
Spain says migrants are returning to Ceuta after 57 killed in border rush
Kuwait intercepts hostile drones after attacks on vital, military sites
