An attack on a synagogue in the eastern German city of Halle in the state of Saxony-Anhalt sent shockwaves across the country on Wednesday. Authorities have arrested a 27-year-old man they suspect carried out the attack and have indicated that they believe he acted alone.

Police said the suspect, identified as Stephen B., had no previous arrests, but the targets of the shooting suggest that the gunman had anti-Semitic and xenophobic beliefs. German Interior Minister Horst Seehofer said that anti-Semitism was certainly one of the shooter's motives.

Shooting began at synagogue, ended at kebab shop

The shooting occurred in the early afternoon when the perpetrator attempted but was unable to enter the synagogue. He then shot and killed a woman near the entrance to the adjacent Jewish cemetery.

The assailant then got back into his car and drove to a nearby kebab shop where he killed a second person. Police later said they had found an improvised explosive device near the synagogue.

Two more people were injured during the rampage in Halle. Local authorities said the two, a man and a woman, were treated for gunshot wounds. They are no longer in a critical condition, according to hospital officials.

The suspect was apprehended by city police after he crashed his car.

Read more: The deadly danger of being a Jew in Germany

The gunman shot at the door to the synagogue, but did not get in

Synagogue witness: 'We have a lot to be grateful for today'

Jeremy Borovitz, a US rabbinical student who lives Berlin, was one of the around 60 people inside the synagogue in Halle when the shooting took place and praised the quick actions of the synagogue leadership and its private security guard.

"Around noon, the private security guard was observing a man outside on camera. We heard a boom. Immediately we called the police. Then a pause. Then pop-pop-pop. The guard and synagogue leaders immediately told everyone to go upstairs, keep our heads down," he told DW.

Borovitz, who was attending Yom Kippur services with his wife Rebecca Blady and around 12 other Americans, added: "We have a lot to be grateful for today."

Ezra Waxmann, one of the other Americans in the group, said things were fairly calm during the shooting, but that the issue of security had been discussed the night before.

"Today I feel a lot more somber because people were killed. Yesterday was more about just being thankful for the miracle that [the gunman] couldn't get through the door, and that a much bigger tragedy didn't happen," he told DW.

After failing to enter the synagogue, the gunman began shooting at a kebab shop just down the street

Shooter denies Holocaust in video of attack

Dressed in combat gear, the attacker was also wearing a helmet with a camera, which he used to live-stream the attack on Amazon's streaming platform Twitch.

During the 35-minute video, the assailant ranted against feminism and denied the Holocaust, he also made xenophobic and misogynistic statements.

The original live-stream was quickly removed from the site, Twitch said in a statement.

"We worked with urgency to remove this content and will permanently suspend any accounts found to be posting or reposting content of this abhorrent act," the gaming platform said in a Tweet.

Technical failures saved lives

The shooter used multiple weapons, including homemade bombs and what appears to be a homemade rifle. He experienced repeated technical failures during the attack, which ultimately saved lives.

A man who stopped his vehicle to check on the woman shot outside the synagogue was able to get away unharmed when the shooter's weapon failed to fire.

It jammed again after he began firing at the kebab shop. Several people were able to flee. In the live-stream of the attack, the assailant apologizes to the viewers repeatedly for his failure to kill.

The attack put the city in a lockdown for several hours as police followed leads that suggested accomplices may have fled the scene. The lockdown also affected national train traffic, as the train station, a hub between Berlin, Munich and Hamburg, was shut down.

Regional freeways were affected as well while police responded to reports of gunfire in the nearby city of Landsberg, where police conducted house-to-house searches later in the day.

Police subsequently announced that it was safe for people in Halle to leave their homes, yet as DW's Kate Brady reported live from the scene, there was an eerie silence across the city as flashing blue lights illuminated the night while police continued to search for evidence.

'Scandalous that police weren't protecting synagogue'

Politicians and religious leaders condemned the attack, which occurred on the Jewish holy day of Yom Kippur, and expressed their solidarity with Germany's Jewish community.

Josef Schuster, president of the Central Council of Jews in Germany, said, "The brutality of the attack surpasses everything we have seen in recent years and is deeply shocking to all Jews in Germany."

Schuster was also critical of police, "It is scandalous that police were not protecting the synagogue in Halle on a holiday like Yom Kippur."

Synagogues in many German cities receive special police protection, and Yom Kippur, also known as the Day of Atonement, is the highest holy day in the Jewish calendar.

World Jewish Congress chief Ronald Lauder called on Germany to provide Jewish institutions the protection they need and deliver with "action rather than words."

Expressions of shock and solidarity

German Chancellor Angela Merkel, who attended a vigil on Wednesday evening at a synagogue in Berlin, conveyed her "deepest condolences." Steffen Seibert, Merkel's spokesman, wrote on Twitter: "Our solidarity is with Germany's Jews on this Yom Kippur. Our thanks go out to security forces still deployed."

Foreign Minister Heiko Maas also addressed the attack on Twitter, writing: "That on Yom Kippur a synagogue was shot at touches all our hearts. We must all act against anti-Semitism in our country."

Leaders of Germany's Catholic and Protestant churches also expressed condolences to "our Jewish brothers and sisters," calling on people of faith to stand up against the scourge of anti-Semitism.

DW's Kate Brady and William Noah Glucroft contributed to this report.