Numbers 25:17

Vex the Midianites, and smite them:

Vex the Midianites, and smite them. Go to war with them, and smite them with the sword; not the Moabites, but the Midianites, though they were both confederates against Israel; but God had given a charge not to contend in battle with Moab, Deuteronomy 2:9, they were spared for the sake of Lot, from whom they sprang; and, as Jarchi says, for the sake of Ruth, who was to come from them; and so in the Talmud {l}; though they did not entirely escape the divine resentment, as appears from

Deuteronomy 23:3 but the Midianites were the first that advised to send for Balaam, and with them he stayed and was entertained, after he had been dismissed by Balak; and it seems as if it was to them he gave the wicked counsel, to draw Israel into fornication, and so into idolatry, and thereby bring the curse of God upon them; which advice they communicated to the Moabites, and both were concerned in putting it into execution; see Numbers 22:4.

{l} T. Bab. Bava Kama, fol. 38. 2.