Temple Israel in Oakland County, Michigan, prepared for a worst-case scenario before a deadly attack that left the gunman dead and no one inside the building harmed, federal and local officials said. FBI Special Agent in Charge Jennifer Runyan said the attacker, identified by officials as Ayman Mohammad Ghazali, died in the incident after a private security guard returned fire once he opened fire through his windshield inside the synagogue. Runyan said the gunman drove his car into the building and that his attack unfolded in a hallway where early childhood learning center students were present.

According to Runyan, the synagogue had 140 students inside the early childhood learning center at the time, and all were unscathed. She described the incident as ending with only the attacker dying, after his car’s engine caught fire and after he eventually used his own weapon to fatally shoot himself. “If they had not done their job almost perfectly we would be talking about an immense tragedy here today with children gone,” U.S. Sen. Elissa Slotkin said in comments carried by the Associated Press.

State and federal leaders also pointed to the security response inside the building. Michigan Gov. Gretchen Whitmer said, “These heroes threw themselves in harm’s way, engaging a suspect.” Temple Israel rabbis and officials said the security steps taken before the attack helped prevent injuries. One of Temple Israel’s rabbis said “it was only a miracle” that none of the synagogue’s members were hurt.

The efforts to bolster Temple Israel’s security began months earlier, with the synagogue bringing in experienced law enforcement leadership to guide in-house security. The temple hired Danny Phillips, described in the report as a former police lieutenant, to serve as its security director for its armed security guards, with the synagogue saying it was taking a proactive step “in response to the evolving realities facing Jewish communities.” The report said Phillips served in law enforcement for almost three decades, including more than 20 years as his department’s advanced firearm instructor, citing a police academy course listing on a college website where he teaches.

The synagogue also carried out training intended to prepare staff for active-shooter situations. In January, Temple Israel’s staff and clergy participated in active shooter prevention and preparedness training led by an FBI official, according to the synagogue’s social media accounts, as described in the Associated Press report. As this story circulated, MSI previously reported that heightened fears for houses of worship have driven security planning in the months following an escalation in the region’s conflict; that broader context set the stage for more intensive preparations at local faith sites.

Officials said the temple’s coordination with law enforcement added another layer of readiness. Oakland County Sheriff Mike Bouchard said on Thursday that he had contacted the head of security for the temple just two days before the attack, crediting the thorough preparation ahead of the incident as the reason that there weren’t casualties. While the gunman died during the attack, Ron Amann, a member of the safety team at CrossPointe Community Church in Wayne, said he was still recovering after being shot in the leg in an earlier incident in June when a man tried to attack his church. Amann described how he responded when he heard about the event involving the synagogue, saying he passed his grandson to his wife after a woman yelled, “There’s a man with a gun.”

Amid that wider pattern of churches and synagogues working to improve preparedness, Pastor Bobby Kelly said his staff sheltered in place after hearing about the synagogue attack. “When you hear of something happening,” Kelly said, “you don’t know where it’s going to happen next.” Temple Israel Rabbi Jennifer Kaluzny told CNN that despite the outcome, the planning required after such attacks has become part of life for the Jewish community, saying, “Unfortunately the entire Jewish community, no matter where we are in the world, we have to plan for things like this.”