PITTSBURGH — Armed with an AR-15-style assault rifle and at least three handguns, a man shouting anti-Semitic slurs opened fire inside a Pittsburgh synagogue Saturday morning, killing at least 11 congregants and wounding four police officers and two others, the authorities said.

In a rampage described as among the deadliest against the Jewish community in the United States, the assailant stormed into the Tree of Life Congregation, where worshipers had gathered in separate rooms to celebrate their faith, and shot indiscriminately into the crowd, shattering what had otherwise been a peaceful morning.

The assailant, identified by law enforcement officials as Robert D. Bowers, fired for several minutes and was leaving the synagogue when officers, dressed in tactical gear and armed with rifles, met him at the door. According to the police, Mr. Bowers exchanged gunfire with officers before retreating back inside and barricading himself inside a third-floor room. He eventually surrendered.

Mr. Bowers, 46, was injured by gunfire, although the authorities said it was unclear whether those wounds were self-inflicted or whether the police had shot him. He was taken to Allegheny General Hospital.

Federal officials charged Mr. Bowers with 29 criminal counts. They included obstructing the free exercise of religious beliefs — a hate crime — and using a firearm to commit murder. He also faces state charges, including 11 counts of criminal homicide, six counts of aggravated assault and 13 counts of ethnic intimidation.

The authorities said that he had no previous criminal history.

[Read more about the shooting suspect, who frequently reposted anti-Semitic content on social media.]

Though a bris, a ceremony to mark a child’s birth, was among the ceremonies taking place Saturday, no children were among the casualties, law enforcement officials said. The wounded included a 70-year-old man who had been shot in the torso, and a 61-year-old woman with soft tissue wounds, said Dr. Donald Yealy, chairman of emergency medicine at the University of Pittsburgh School of Medicine.

The attack Saturday morning struck the heart of the city’s vibrant Jewish community, in the leafy Squirrel Hill neighborhood that is home to several synagogues, kosher restaurants and bakeries. Hours later, hundreds gathered at three separate interfaith vigils on a cold, rainy evening to mourn the dead and pray for the wounded.

The assault on the synagogue unfolded on a quiet, drizzly morning, and came amid a bitter, vitriolic midterm election season and against the backdrop of what appears to be a surge in hate-related speech and crimes across America. It also took place in the wake of the arrest Friday morning of a man who the authorities said sent more than a dozen pipe bombs to critics of Mr. Trump, including several high-profile Democrats.