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 (9lb) of explosives in his car, Ms Lambrecht said in a statement with attorney-general Peter Frank.
Mr Frank said the gunman had been planning a massacre.
The suspect, 27, faces two counts of murder and nine counts of attempted murder, German media report.
- Is there a growing far-right threat online?
- Germany to fight anti-Semitism in schools
- German politician’s murder raises spectre of far-right attacks
The German national is due to appear in court on Thursday afternoon.
Prosecutors allege he intended to create a “worldwide effect” by deliberately mimicking tactics used during a mass shooting at two New Zealand mosques earlier this year.
About 2,200 people watched a live stream he allegedly posted on the online streaming platform Twitch.
Could the attack have been prevented?
About 60 worshippers were at a Yom Kippur service at the time of the attack.
German police have faced criticism from the nation’s most prominent Jewish community group, which accused the force of “negligence” in its handling of the attack.
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.
“We must make sure that we must protect our Jewish citizens much better,” said Ms Lambrecht.
How did the attack unfold?
The video – which was removed from Twitch – shows a man making anti-Semitic and misogynistic comments before driving to the synagogue and shooting at its door.
After failing to get into the synagogue, the gunman 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 say the gunman also tried to set off explosives at the synagogue.
Witnesses say he was heavily armed, and an online anti-Semitic “manifesto” attributed to him shows guns, apparently home-made.
- Germany shooting: 2,200 people watched on Twitch
- In pictures: Germany Halle gun attack
Survivors say they hid behind the synagogue’s heavy locked doors until police arrived, which took more than 10 minutes.
How big a threat is anti-Semitism in modern Germany?
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.
“We unfortunately have to face the truth, which – for some time already – is that the threat of anti-Semitism, right-wing extremism, and right-wing terrorism is very high,” Interior Minister Horst Seehofer told reporters on Thursday.
German police 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.
Oliver Malchow, chairman of the German police union (GdP), said police were too thinly spread for 24-hour protection of places of worship.
“While we’re tackling terrorism we cannot at the same time involve many staff in monitoring far-right extremists,” he told German broadcaster ZDF. “We didn’t underestimate it, but we can’t foresee everything and prevent it.”
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.