A shooting at a synagogue in the German city of Halle on Monday was a far-right terror attack, said justice minister Christine Lambrecht.
Alleged perpetrator Stephan Balliet had four kilos of explosives in his car, Ms Lambrecht said in a joint statement with attorney-general Peter Frank.
The gunman was planning a “massacre”, said Mr Frank said.
About 2,200 people watched a live stream he allegedly posted on the online streaming platform Twitch.
Mr Balliet, 27, who is due to appear in court on Thursday afternoon, is facing two counts of murder and nine counts of attempted murder, German media report.
German police have faced criticism in the wake of the attack from the nation’s most prominent Jewish community group, which accused the force of “negligence”.
The head of the Central Council of Jews said it was “scandalous” that police were not protecting the synagogue on the Jewish Yom Kippur holiday.
“If police had been stationed outside the synagogue, then this man could have been disarmed before he could attack the others,” said the council’s president, Josef Schuster, on Deutschlandfunk public radio.
In a tweet, Mr Schuster added that it was “a miracle that there were no further casualties” during the incident at the city’s synagogue. About 60 worshippers were at a Yom Kippur service at the time.
The suspect is a German national.
The video – which was removed from Twitch – showed him making anti-Semitic and misogynistic comments before driving to the synagogue and shooting at its door.
After failing to get into the synagogue, he shot dead two people: a woman in a nearby street and a man inside a kebab shop about 500 metres (yards) away. Two people were also wounded by bullets and underwent surgery.
Reports said the gunman also tried to set off explosives at the synagogue.
Witnesses said he was heavily armed, and an online anti-Semitic “manifesto” attributed to him shows guns, apparently home-made.
Survivors said they hid behind the synagogue’s heavy locked doors until police arrived, which took more than 10 minutes.
“This case shows us how thinly spread the police cover is,” Oliver Malchow, chairman of the GdP, told German broadcaster ZDF.
“While we’re tackling terrorism we cannot at the same time involve many staff in monitoring far-right extremists,” he added. “We didn’t underestimate it, but we can’t foresee everything and prevent it.”
Authorities have noted a recent rise of anti-Semitic incidents in Germany, a country that is still haunted by the murder of six million Jews under Nazi rule.
They provide varying degrees of protection to synagogues. But when this is not possible, local Jewish communities sometimes work with law enforcement to provide for their own security.
Since the shooting, police presence has been increased outside synagogues in several east German cities, including Leipzig and Dresden, according to local media.
The attack was condemned by European leaders, including German Chancellor Angela Merkel. At an event in Nuremberg, Ms Merkel said the government would use “all means available” to tackle hatred and bigotry.
Elsewhere, Israeli Prime Minister Benjamin Netanyahu described the shooting as a “terror attack” and warned anti-Semitism was on the rise in Europe.