BERLIN — A heavily armed assailant with a live-streaming head camera tried unsuccessfully to invade a synagogue during Yom Kippur services in an east German city on Wednesday, then killed two people outside and wounded two others in what the government called an anti-Semitic assault.
It was one of the most brazen in a string of recent attacks aimed at Jews in Germany, and bore a striking resemblance to the rampage by a far-right extremist on two mosques in New Zealand more than six months ago, in which he broadcast his killings live on social media. Fifty-one people died in that attack.
A total of 51 congregants, including 10 young American visitors, were in the synagogue in the eastern city of Halle during the assault, committed on the holiest day in Judaism, but officials said none were believed hurt.
“Based on the information that we have at this point, we must assume that at the least, this was an anti-Semitic attack,” said Horst Seehofer, Germany’s interior minister.
The assailant broadcast at least parts of the attack via Twitch, a live-streaming platform owned by Amazon, which has struggled with moderating the real-time content that floods in from millions of active broadcasters. Alerted to the broadcast, Twitch scrambled to remove it and issue an apology.
“We are shocked and saddened by the tragedy that took place in Germany today, and our deepest condolences go out to all those affected,” the service said in a statement. “Twitch has a zero-tolerance policy against hateful conduct, and any act of violence is taken extremely seriously.”
Rita Katz, head of the SITE Intelligence Group, which monitors extremist groups online, said on Twitter that the man wearing the camera was heard to say in English that the “root of all problems are the Jews.”
There were conflicting accounts on the number of assailants. The police said earlier that at least two and possibly three gunmen had opened fire near the synagogue, but Mr. Seehofer spoke only of one.
Parts of Halle, the birthplace of Handel, were locked down by the police for hours in a search for an assailant or assailants, believed to have fled in a car. By late evening restrictions in the city were lifted, the train station reopened and traffic returned to normal.
“Our city was shaken by a terrible attack today,” said Bernd Wiegand, the mayor of Halle. “Two people lost their lives and two others are being treated in the hospital for their injuries.”
Germany’s foreign minister, Heiko Maas, deplored the assault on Twitter, saying, “We all must act against anti-Semitism in our country.”
Recent weeks have been punctuated by a number of small attacks on Jews in Germany, where anti-Semitism is an especially sensitive legacy of the Nazi era. Earlier this year, Germany’s top security official condemned a jump in the anti-Semitic attacks, ranging from vandalism to targeting individuals wearing visible emblems of their faith. After Wednesday’s shooting, police reinforcements were sent to synagogues across the country.
The identity of the Halle shooter remained unclear. Video footage shown by the local broadcaster MDR showed a gunman dressed in black and wearing a helmet, exiting the driver’s side of a compact car and opening fire in several directions.
The identities of the victims were not immediately clear. Local news media reported that one victim, a man, had been killed in a kebab shop near the synagogue and that a woman had been fatally shot in the street.
Germany’s federal prosecutor took over the investigation “on suspicion of murder under special circumstance,” said Dirk Hackler, a spokesman for the prosecutor’s office, but he declined to give further details.
The last time the federal prosecutor made such a move was after the slaying of Walter Lübcke, a pro-refugee district representative and member of Chancellor Angela Merkel’s conservative party who was slain in June.
A witness to the shooting in Halle told MDR that he had seen a gunman dressed in military gear and armed with several weapons firing at the synagogue. Other news outlets reported that a hand grenade had been thrown into a Jewish cemetery nearby.
Prayers for Yom Kippur began at 9:30 a.m. Wednesday and had been scheduled to continue until 8:30 p.m. It is the most solemn day in the Jewish calendar, and services brought many people to the temple.
Max Privorozki, a leader of the Jewish community in Halle, told the Jewish Forum for Democracy that despite repeated requests for the police to provide security at the synagogue, there was no one outside when the attacker tried to force his way in. It took 10 minutes for the police to respond, he added, when he called for help.
Police officials in Halle could not confirm whether there had been a security detail outside the synagogue, as is common in many of Germany’s larger cities.
“The attacker fired several times at the door and threw petrol bombs, firecrackers or other explosives to try to force his way in,” Mr. Privorozki was quoted by Der Spiegel as saying. “But the door stayed shut — God protected us.”
The police told MDR that more shots had been fired later in Landsberg, a suburb of Halle, though those reports could not be independently confirmed.
Immediately after the shooting in Halle, television footage showed police officers wearing helmets and carrying automatic weapons as they patrolled streets around the synagogue that had been sealed off with red-and-white tape. Other officers used a ladder to climb over a high brick wall surrounding the cemetery.
Anti-Semitic crime and hate crimes targeting foreigners have both increased almost 20 percent in Germany over the past year, according to official figures published in May. The data included a wide range of offenses, including assault, insults, graffiti, hateful postings online and the use of Nazi symbols.
Many Jewish institutions in Germany, including synagogues, schools and other cultural centers, are guarded by the local police. In Berlin, which has the country’s largest Jewish population, the police have also provided security to cafes, restaurants and shops that are owned and frequented by Jews.
Earlier this year, the country’s top official for efforts against anti-Semitism warned that Jews should not wear their skullcaps everywhere in public.
Halle, with a population of 230,000, is 100 miles southwest of Berlin and is the largest city in the eastern state of Saxony-Anhalt. it boasts Gothic and Renaissance architecture, but today is a regional seat of trade and commerce.
As news of Wednesday’s shooting spread, condemnation and concern flowed in from across Europe. In Brussels, the president of the European Parliament, David Sassoli, expressed his condolences and called for a moment of silence for the victims. The Anti-Defamation League in New York called the attack “heartbreaking” and “devastating,” and thanked those in law enforcement for keeping “our houses of worship and communal institutions safe and secure on this day and every day, in the U.S. and around the world.”
The United Nations secretary general, António Guterres, said in a statement that he regarded the events in Halle as “yet another tragic demonstration of anti-Semitism — perpetrated on the holy day of Yom Kippur — which needs to be fought with the utmost determination.”