Rabbi Phineas said: The Holy One, blessed be He, said to Moses: Do ye remember what those Midianites did to you, for twenty-four thousand men fell in Israel? But before "thou art gathered in," arise, execute vengeance, (as it is said,) "Avenge the children of Israel of the Midianites; afterwards shalt thou be gathered unto thy people" (Num. 31:2).

What did Moses do? He took a thousand men (and) a prince from each tribe of the tribes of Israel. Behold, (there were) twelve thousand (men), and he who had been zealous because of the immorality, was the prince over them. The holy vestments and the trumpets of alarm were in his hand, and they went, and they took captive the daughters of Midian, and they brought them (to the camp). (Moses) said to (Phineas): Because of these did not twenty-four thousand men of Israel fall? as it is said, "Behold, these caused the children of Israel, through the counsel of Balaam, to commit trespass against the Lord in the matter of Peor" (Num. 31:16); and he began to be angry with them, as it is said, "And Moses was wroth with the officers of the host" (Num. 31:14). During his anger the Holy Spirit departed from him. Hence thou mayest learn that the impetuous man destroys his wisdom. Eleazar saw and he heard (the voice) behind (Moses), as it is said, "And Eleazar the priest said unto the men of war… This is the statute of the Law which the Lord hath commanded Moses" (Num. 31:21). He said to them: He commanded Moses and He did not command me.