Chancellor Olaf Scholz condemned the “brutal act of violence” and said his thoughts were with the victims and their loved ones.
The Jehovah’s Witnesses in Germany association said it was “deeply saddened by the horrific attack on its members”.
The first emergency calls were made around 2015 GMT after shots rang out at the building in the city’s northern district of Gross Borstel.
Hamburg police are due to give an update at a press conference around midday, but earlier said they were still working to find out the motive for the attack.
“At the moment there is no reliable information on the motive of the crime,” police said, urging people not to speculate.
An alarm for “extreme danger” in the area was sounded using a catastrophe warning app, but Germany’s Federal Office for Civil Protection lifted it shortly after 3:00 am local time.
The port city’s mayor, Peter Tschentscher, expressed shock at the shooting on Twitter.
Police have asked witnesses to come forward and upload any pictures or videos they may have to a special website.
Interior Minister Nancy Faeser said investigators were “working flat-out to determine the background” to the attack.
News weekly Der Spiegel reported that the suspected attacker was a former member of the Jehovah’s Witness community who was not a known extremist.
The magazine, which did not cite its sources, described him as a man aged 30-40 and said he had been armed with a handgun.
– Bible study group –
The attack took place at the Jehovah’s Witnesses Kingdom Hall building, a non-descript, three-storey building where members had gathered for a religious service.
There are about 175,000 people in Germany, including 3,800 in Hamburg, who are Jehovah’s Witnesses, a US Christian movement set up in the late 19th century that preaches non-violence and is known for door-to-door evangelism.
The first officers at the scene found several lifeless bodies and seriously wounded people, police said.
Hamburger Abendblatt reported that 17 unhurt people, who had been at the event, were being attended to by the fire brigade.
Officers heard a shot in the “upper part of the building” before finding a body in the area where it rang out, police said.
In a tweet early on Friday, Hamburg police said they assumed the body belonged to the perpetrator.
– Hit by attacks –
Germany has been rocked by several attacks in recent years, both by jihadists and far-right extremists.
Among the deadliest committed by Islamist extremists was a truck rampage at a Berlin Christmas market in December 2016 that killed 12 people.
The Tunisian attacker, a failed asylum seeker, was a supporter of the Islamic State jihadist group.
Europe’s most populous nation remains a target for jihadist groups in particular because of its participation in the anti-Islamic State coalition in Iraq and Syria.
Between 2013 and 2021, the number of Islamists considered dangerous in the country had multiplied by five to 615, according to interior ministry data.
But Germany has also been hit by several far-right assaults in recent years, sparking accusations that the government was not doing enough to stamp out neo-Nazi violence.
In February 2020, a far-right extremist shot dead 10 people and wounded five others in the central German city of Hanau.
And in 2019, two people were killed after a neo-Nazi tried to storm a synagogue in Halle on the Jewish holiday of Yom Kippur.