As New York City’s government pieces together exactly what led to the fatal collapse of an Upper East Side crane, a neighborhood Jewish congregation termed the survival of members whose building was struck by the machine as nothing short of a miracle.

“Two of our families were miraculously saved,” said Rabbi Uriel Vigler, co-director of the Chabad Israel Center, which holds Shabbat services at the Courtyard by Marriott hotel caddy-corner to where a crane operator and another construction worker died in the Friday collapse. “The apartment of one woman’s daughter completely collapsed. Another parent was taking her child to preschool, when the crane missed them by a couple of feet.”

Vigler hosted a prayer service attended by 20 people half a block from the site Sunday night.

At the service, Rafi Aharon, 40, told The Associated Press that he left his apartment building at the corner of 91st Street and First Avenue with his 7-year-old son, Roy, less than a minute before part of the 200-foot crane smashed into the building.

“It was very scary,” said Aharon.

For his part, Vigler said that the people gathered at the service “thanked G‑d at the miracle of their survival. It could have been much worse.

“At the same time,” he added, “our prayers go out to the families of the victims. We also pray that those who were injured should have a speedy recovery.”

The accident came 10 weeks after another construction crane toppled a Midtown Manhattan townhouse, killing four people, and barely missing the headquarters of Chabad-Lubavitch of Beekman-Sutton.