MAINZ, Germany — The man accused of carrying out an anti-Semitic attack in Germany ended up killing two people outside a synagogue after he failed to get inside, officials said Thursday.

The Federal Prosecutor's Office in Karlsruke provided a chilling blow-by-blow account of how the "far-right extremist" suspect, identified only as "Stephan B," unleashed a horrific torrent of bullets and bombs in the eastern German town of Halle on Wednesday.

The shocking attack unfolded on the high holy holiday of Yom Kippur as 51 worshippers were attending services inside the synagogue.

"The accused wanted to enter the synagogue and kill as many people as possible of Jewish faith," according to a statement by federal prosecutors.

After finding the front entrance locked, he tried to blow up a gate which allows cars into the complex but "the explosive device failed to have the desired effect," prosecutors said.

He then opened fire on a woman, 40, passing by on the street, authorities said. Then as she "was lying lifeless on the ground," that's when he "fired another round at her," killing her, prosecutors said.

Stephan B eventually returned to the synagogue's doors where he tried unsuccessfully to kick or shoot his way inside, authorities said.

"Frustrated by this ill success, the accused made the decision to leave the site and to kill citizens of migration background," according to prosecutors. He allegedly went to a nearby kebab restaurant and opened fire on several men, hitting one.

The victim was "still lying in a niche behind the refrigerators" when Stephan B. returned after a short while and then "killed him with several shots," prosecutors said.

After responding officers wounded Stephan B. in the neck during a shootout, he still managed to escape and hijack a taxi before crashing it, allowing police to catch him, federal authorities said.

Police had not been able to immediately link the suspect to any far-right terrorist groups.

Eckardt reported from Mainz and Li from New York