Balaam's prophecy, "He shall not lie down until he eat of the prey, and drink the blood of the slain," was very quickly fulfilled. Shortly before his death, before he lay down to everlasting sleep, it was granted Moses to rejoice in the death of Balaam and the five Midianite kings allied to him.  Israel's sinful profanation at Shittim, occasioned by Balaam's wicked advice, sorely smote Moses' heart. God had appointed Moses as lord of the angels, who through fire and cloud had to step aside to make room for him and let him pass, yea, at his appearance they rose from their seats to do him honor. As he had power over the angels, so too did he rule the sea, which he clove at will and then commanded to resume its former guise, and the treasures of hail, which he employed to sent hail over the Egyptians. Now this man, who was sovereign over the angels and over the forces of nature, could only weep when Israel committed whoredom with the daughters of Moab and Midian. To comfort Moses, God now said: "As truly as thou livest, thou shalt not depart out of this world until thou shalt have avenged those who tempted Israel to sin. 'Avenge the children of Israel of the Midianites: afterward shalt thou be gathered unto thy people.'"  God at the same time reproached Moses for his despair and lack of energy at Shittim, saying: "When all the tribes of Israel, save the tribe of Levi, were against thee, thou didst not then lack courage to stand up against all the people on account of the worship of the Golden Calf; how much more then at Shittim, when all Israel save only one tribe, the tribe of Simeon, were on thy side, shouldst thou have proven thyself sufficiently strong to keep back the sinners from their sin!"  When Moses received the command to wage war upon the people that had tempted Israel to sin, he said to God: "Yesterday didst Thou say to me, 'Vex not Moab,' and now Thou sayest, 'Avenge the children of Israel.'" God, however, replied: "When I said, 'Vex not Moab,' I named these people after their grandsire, the son of Lot, but not that through their own fault they have lost the claim to kind treatment from Israel, I shall no longer think of their grandsire Abraham's kinsman, but shall call them Midianim, 'they that lost their claim.'" 
Lot's descendants now not only had no further claims to exemption, but a command was given to Moses to treat them with still greater hostility than the other nations. Until then it had been Israel's duty not to fight against a city of the heathens unless they had first proclaimed peace to it and the heathens had refused to accept it, but now they were instantly to proceed to hostility; and whereas they had formerly been prohibited from destroying the trees that surrounded a city, they were now ruthlessly to destroy all that lay in their path. This wrath of God against those who had tempted Israel to sin was justified, for "the tempter to sin is him of this world alone, but he that tempts another deprives him of this world and the world beyond." Two nations, the Egyptians and the Edomites, attacked Israel with the sword, but God nevertheless said, " Thou shalt not abhor an Edomite; thou shalt not abhor an Egyptian." The Moabites and Ammonites, on the other hand, tempted Israel to sin, hence God's word concerning them was as follows: "An Ammonite or Moabite shall not enter into the assembly of the Lord, even to the tenth generation." 
Israel received the command to make war upon the Midianites at the same time as that to fight the Moabites, but whereas Moses at once waged war against Midian, it was not until David's time that a relentless war was waged against Moab. There was several reasons why the Midianites were to receive their punishment before the Moabites. Firstly, Moab's hatred against Israel was not quite without foundation, for although the Israelites had not attacked them in war, still they had inspired them with great fear by pillaging the Moabite region, hence the Moabites tried by every means to be rid of Israel. Midian, on the other hand, had no cause for undertaking hostilities against Israel, and yet they not only joined the Moabites, but outdid them in their hatred against Israel. Furthermore Moab wanted to kill Israel, but Midian wanted to tempt them to sin, which is worse than death.  The delay in punishing Moab also corresponded in other ways to God's plan, for the Moabite Ruth was destined to become the mother of the dynasty of David, hence God said to Israel: "Wait yet a while in this matter of the war against the Moabites: I have lost something valuable among them. As soon as I have found it, ye shall avenge yourselves of them." 
God indicated that the war against Midian would be Moses' last in these words, "Avenge the children of Israel of the Midianites: afterward shalt thou be gathered unto thy people." The connection between the war and Moses' death is as follows. When God announced to Moses that he was to die on this side of the Jordan, Moses implored God with the words: "O Lord of the world! Is it right that death should so soon overtake me, that have seen Thy ways, Thy actions, and Thy path?" God replied, saying: "Moses, if a long life were better for men, surely I should not then have permitted thy ancestors to taste of death; but it is better for thee if thou are taken from this world than if thou wert to remain in it." Moses was not, however, satisfied with this answer from God, whereupon God said: "Well then, thou mayest live many years longer, yea, thou shalt live even to a thousand years, but know thou that Israel will not then conquer their foes, and that Midian will not be brought under their yoke." In this way was Moses made to yield by God, for he thought, "Whether I die to-day or to-morrow matters little, for death will come to me at last. I would rather see Israel conquer their foes and bring Midian under their yoke than that I should live longer." God therefore bade Moses avenge Israel of the Midianites, if he was thereupon ready to die. 
Moses then thought: "I know that if I were now to go into battle against the Midianites, the people would declare that I wished for my own death, since God made it dependent upon the punishing of the Midianites, and my life is assured me as long as ever I wish to put it off." This consideration did not, however, determine him, for, fully aware that his enterprise of war would hasten his death, he nevertheless set about the execution of this war as soon as God commanded him. Wherever the execution of a Divine command, or the possibility of furthering Israel's cause was concerned, Moses gave no thought to himself, even though it touched his life. Not so Joshua. When he came to Canaan, he thought: "If I wage an incessant war upon the Canaanites, I shall certainly die as soon as I shall have conquered them, for Moses also died immediately after his conquest of Midian." He therefore proceeded very slowly in his conquest of the Holy Land, so that he might be sure of a long life. But, "however many thought there may be in man's heart, God's words prevails," and whereas Joshua hoped to become very aged, he died ten years before the time God had originally allotted to him, for, although he would otherwise have attained his master's age, he now died at the age of a hundred and ten.