BNEI BRAK, Israel — By the time the mayor of Bnei Brak grasped the deadly seriousness of the coronavirus pandemic, his city had already become Israel’s biggest center of contagion.

An ultra-Orthodox enclave in the shadow of Tel Aviv, Bnei Brak had one in seven of Israel’s cases, and as many as a third of its 210,000 residents were expected to get sick.

The very customs that have protected its venerable traditions from change — strict limits on modern technology, an aversion to secular media, a deep suspicion of state institutions — had deafened Bnei Brak’s residents to urgent public health warnings. Densely packed with sprawling families in shoe-box apartments whose lives revolved around shoulder-to-shoulder worship and study, it was fertile ground for the rapid spread of Covid-19.

In desperation, Mayor Avraham Rubinstein reached outside his community for help from people the ultra-Orthodox have long seen as a threat to their way of life: the army.