There were 10 Americans inside a synagogue in Germany when a gunman unsuccessfully tried to enter before killing two people outside on Wednesday, the U.S. ambassador to Germany said.

The Americans are "safe and unharmed," Ambassador Richard Grenell tweeted.

A heavily armed assailant shot at the synagogue, which was packed with 70 to 80 people observing Yom Kippur, the Jewish day of atonement.

The gunman then killed two people while outside the building and going into a nearby kebab shop, according to German authorities and witnesses.

A person lies on a road in Halle, Germany, after a gunman fired several shots and killed two people. (Sebastian Willnow/dpa via AP)

A person lies on a road in Halle, Germany, after a gunman fired several shots and killed two people. (Sebastian Willnow/dpa via AP)

The attack took place in the eastern city of Halle and is being regarded as a hate crime, according to a top German security official.

UN RELEASES FIRST-EVER REPORT ON ANTI-SEMITISM HIGHLIGHTING UPTICK

German Interior Minister Horst Seehofer said the attack might have been driven by anti-Semitism and far-right motives, according to prosecutors.

The German news magazine Der Spiegel said a 27-year-old suspect from the state of Saxony-Anhalt, where Halle is located, was arrested.

Police officers cross a wall at a crime scene in Halle, Germany, after a shooting on Wednesday. (Sebastian Willnow/dpa via AP)

Police officers cross a wall at a crime scene in Halle, Germany, after a shooting on Wednesday. (Sebastian Willnow/dpa via AP)

The suspected shooter streamed 35 minutes of the episode on Amazon-owned Twitch, which confirmed the live broadcast in a series of tweets on Wednesday.

The account used was created about two months ago and the user had only attempted to stream once before, the company said.

"A recording of the stream, which was automatically generated based on the account’s settings, was viewed by approximately 2200 people in the 30 minutes before the video was flagged and removed from Twitch," it said.

"Once the video was removed, we shared the hash with an industry consortium to help prevent the proliferation of this content," Twitch said. "We take this extremely seriously and are committed to working with industry peers, law enforcement, and any relevant parties to protect our community."

A spokesperson for German Chancellor Angela Merkel said that the shooting was "terrible news from Halle," and that government officials had no further information on the attack.

CLICK HERE TO GET THE FOX NEWS APP

Fox News' Nicole Darrah and The Associated Press contributed to this report.