Rabbi Azariah said: Amalek was a descendant of Esau, and because of his ancestor's enmity he came against them to punish them. The cloud was surrounding the camp of Israel like a city surrounded by a wall. The adversary and enemy were unable to touch them, but (when) anyone needed a ritual bath the cloud excluded him from the camp of Israel, because the camp of Israel was holy, as it is said, "Therefore shall thy camp be holy" (Deut. 23:14), and (then) Amalek was smiting and slaying the hindmost of those who were beyond the cloud, as it is said, "And he smote the hindmost of thee, all that were feeble behind thee" (Deut. 25:18).