Numbers 31

Numbers 31:8 Balaam the son of Beor they slew with the sword
 
Balaam would not have deserved or suffered this punishment if he had stayed completely true to the word of the Lord. He must have done something to incur God's wrath.
 
Numbers 31:16 these caused the children of Israel, through the counsel of Balaam, to commit trespass against the Lord
 
The Bible is missing some important information about what happened after Balaam prophesied about the Messiah and the fate of Moab. The only thing we can find about this incident is recorded in Numbers 25:
 
And Israel abode in Shittim, and the people began to commit whoredom with the daughters of Moab.
And they called the people unto the sacrifices of their gods: and the people did eat, and bowed down to their gods.
And Israel joined himself unto Baal-peor: and the anger of the Lord was kindled against Israel.
 
It turns out, if the whole story is told, that this idea was Balaam's. It was the prophet who had just said, "I cannot go beyond the commandment of the Lord, to do either good or bad of mine own mind," (Num 24:13) who would now advise the Moabites and Midianites to send their daughters to seduce the Israelites. It was Balaam, once firm in the Lord, who had said, "I have received commandment to bless: and he hath blessed; and I cannot reverse it," (Num 23:20) who feels bad that he has not given Balak the answer he wanted. He should have been satisfied with the answer he received from the Lord. Instead, he felt obliged "even without the will of God" to gratify his suitors.
 
Fortunately, the ancient Jewish historian Josephus, tells us the rest of the story.
 
Josephus
But Balak being very angry that the Israelites were not cursed, sent away Balaam without thinking him worthy of any honor. Whereupon, when he [Balaam] was just upon his journey, in order to pass the Euphrates, he sent for Balak, and for the princes of the Midianites, and spake thus to them:-"O Balak, and you Midianites that are here present, (for I am obliged even without the will of God to gratify you,) it is true no entire destruction can seize upon the nation of the Hebrews, neither by war, nor by plague, nor by scarcity of the fruits of the earth, nor can any other unexpected accident be their entire ruin; for the providence of God is concerned to preserve them from such a misfortune; nor will it permit any such calamity to come upon them whereby they may all perish; but some small misfortunes, and those for a short time, whereby they may appear to be brought low, may still befall them; but after that they will flourish again, to the terror of those that brought those mischiefs upon them. So that if you have a mind to gain a victory over them for a short space of time, you will obtain it by following my directions:-Do you therefore set out the handsomest of such of your daughters as are most eminent for beauty, and proper to force and conquer the modesty of those that behold them, and these decked and trimmed to the highest degree able. Then do you send them to be near camp, and give them in charge, that the young men of the Hebrews desire their allow it them; and when they see they are enamored of them, let them take leaves; and if they entreat them to stay, let give their consent till they have persuaded leave off their obedience to their own laws, the worship of that God who established them to worship the gods of the Midianites and for by this means God will be angry at them. Accordingly, when Balaam had suggested counsel to them, he went his way.
 
So when the Midianites had sent their daughters, as Balaam had exhorted them, the Hebrew men were allured by their beauty, and came with them, and besought them not to grudge them the enjoyment of their beauty, nor to deny them their conversation. These daughters of Midianites received their words gladly, and consented to it, and staid with them; but when they brought them to be enamored of them, and their inclinations to them were grown to ripeness, they began to think of departing from them: then it was that these men became greatly disconsolate at the women's departure, and they were urgent with them not to leave them, but begged they would continue there, and become their wives; and they promised them they should be owned as mistresses all they had. This they said with an oath, and called God for the arbitrator of what they promised; and this with tears in their eyes, and all such marks of concern, as might shew how miserable they thought themselves without them, and so might move their compassion for them. So the women, as soon as they perceived they had made their slaves, and had caught them with their conservation began to speak thus to them:-
 
"O you illustrious young men! we have of our own at home, and great plenty of good things there, together with the natural, affectionate parents and friends; nor is it out of our want of any such things that we came to discourse with you; nor did we admit of your invitation with design to prostitute the beauty of our bodies for gain; but taking you for brave and worthy men, we agreed to your request, that we might treat you with such honors as hospitality required: and now seeing you say that you have a great affection for us, and are troubled when you think we are departing, we are not averse to your entreaties; and if we may receive such assurance of your good-will as we think can be alone sufficient, we will be glad to lead our lives with you as your wives; but we are afraid that you will in time be weary of our company, and will then abuse us, and send us back to our parents, after an ignominious manner." And they desired that they would excuse them in their guarding against that danger. But the young men professed they would give them any assurance they should desire; nor did they at all contradict what they requested, so great was the passion they had for them. "If then," said they, "this be your resolution, since you make use of such customs and conduct of life as are entirely different from all other men, insomuch that your kinds of food are peculiar to yourselves, and your kinds of drink not common to others, it will be absolutely necessary, if you would have us for your wives, that you do withal worship our gods. Nor can there be any other demonstration of the kindness which you say you already have, and promise to have hereafter to us, than this, that you worship the same gods that we do. For has any one reason to complain, that now you are come into this country, you should worship the proper gods of the same country? especially while our gods are common to all men, and yours such as belong to nobody else but yourselves." So they said they must either come into such methods of divine worship as all others came into, or else they must look out for another world, wherein they may live by themselves, according to their own laws.
 
Now the young men were induced by the fondness they had for these women to think they spake very well; so they gave themselves up to what they persuaded them, and transgressed their own laws, and supposing there were many gods, and resolving that they would sacrifice to them according to the laws of that country which ordained them, they both were delighted with their strange food, and went on to do every thing that the women would have them do, though in contradiction to their own laws; so far indeed that this transgression was already gone through the whole army of the young men, and they fell into a sedition that was much worse than the former, and into danger of the entire abolition of their own institutions; for when once the youth had tasted of these strange customs, they went with insatiable inclinations into them; and even where some of the principal men were illustrious on account of the virtues of their fathers, they also were corrupted together with the rest. (Antiquities of the Jews, Book I, 6:6-9, italics added)
 
Josephus
This Balaam, who was sent for by the Midianites to curse the Hebrews, and when he was hindered from doing it by divine providence, did still suggest that advice to them, by making use of which, our enemies had well-nigh corrupted the whole multitude of the Hebrews with their wiles, till some of them were deeply infected with their opinions. (Antiquities of the Jews, Book I, 6:13)