Yisrael’s promise to remain faithful to the One Who delivered the people out of bondage in Mitsraim (Egypt) eroded under the temptation of a flesh-friendly religion. So a former ally of 40 years ago became an existential enemy and had to be defeated. The wisdom of being very careful in making promises and seeking the strength to keep them is the subtext of the Torah reading Matot (“tribes”), covering Numbers 30–32.
