JERUSALEM — Israeli Prime Minister Benjamin Netanyahu has reached an agreement with his ultra-Orthodox allies to avert a potential coalition crisis following the resignation of his health minister over a scandal tied to railway infrastructure work on the Sabbath.

Netanyahu met with his ultra-Orthodox party allies on Sunday and agreed to a series of measures to limit labor on the Jewish Sabbath and preserve the religious status quo in exchange for their continued allegiance.

Ultra-Orthodox Health Minister Yaakov Litzman resigned Sunday over the railway uproar, saying it was a “desecration” that contradicted Jewish values. The move threatened Netanyahu’s coalition by paving way for other religious parties to push for concessions.

Netanyahu also agreed to advance a bill allowing Litzman to serve as deputy health minister, despite a court order barring the practice.