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.
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.
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 extremismRead More – Source