In the 10 commandments, God said:
You shall not bow down to them [idols] or serve them, for I the LORD your God am a jealous God, visiting the iniquity of the fathers on the children to the third and the fourth generation of those who hate me (Exodus 20:5)
Jealousy has such a negative connotation that people wonder why God would call Himself jealous. When we think of jealousy, we think of someone who resents another person for their success, or for what they have. The one who is jealous typically has no right to be. However, we can understand a kind of righteous jealousy in someone who has every right to be jealous. Consider the husband of a woman who is flirting with another man. That feeling that we have is completely right and justified, and that wife might be upset if her husband weren’t jealous. People delude themselves when they try to pretend that such flirting harmless. A man ought to be jealous over his wife or girlfriend. “Jealousy is love protecting it's own,” as I've once heard it described. This is how the Bible speaks of God’s attitude over His people and their worship of idols. God is the “husband”, and when His people worship idols they are like an adulterous wife. God is jealous precisely because He loves His people; like a husband loves his wife.
What we see in the passage above is that, because God is jealous, He “visits the iniquity of the fathers on the children...” When an idolatrous parent teaches their children to worship idols, so that idolatry begins to enter the culture, God will put a stop to it before it goes too far. God will not allow idolatry to take over so that nobody remembers God anymore. He is jealous for His people. This is like a husband who takes vengeance on the adulterous relationship between his wife and some other man. When idolatry becomes a problem in society, that false religion is eventually dealt with by God. In the case of God bringing His people back to Himself, as He did when He sent Israel into captivity, it meant the destruction of their false religion of idols, and therefore of those who practiced those false religions. Those who went into captivity were, in fact, the remnant which God would keep faithful. What we see is a sort of “cleansing” of God's people.
Thus says the LORD, the God of Israel: “Like these good figs, so I will regard as good the exiles from Judah ... I will give them a heart to know that I am the LORD, and they shall be my people and I will be their God, for they shall return to me with their whole heart.” But thus says the LORD: “Like the bad figs that are so bad they cannot be eaten, so will I treat Zedekiah the king of Judah, his officials, the remnant of Jerusalem who remain in this land ... I will send sword, famine, and pestilence upon them, until they shall be utterly destroyed from the land that I gave to them and their fathers.” (Jeremiah 24:5-10)
This passages summarizes the purpose of this great, pivotal event of the Bible. It was to take the righteous remnant out of the way so that the idolatrous Israelites could be dealt with. Those who went into captivity were in fact the ones shown mercy by God. Not only were they spared from the sword and from famine, but they were brought back to God; and history bears this out as we read about the post-exilic community of Israel in the books of Ezra and Nehemiah, for example.
In the book of Hosea we read “My people are destroyed for lack of knowledge; because you have rejected knowledge, I reject you from being a priest to me. And since you have forgotten the law of your God, I also will forget your children.” (Hosea 4:6) This reminds us of the Exodus passage above; the “forgetting their children” relates to “visiting the iniquity of the fathers on the children”. God must put an end to sin because of His love for His people. People often ask, “If God can put an end to sin, why doesn't He?” But if God put an end to it right now, what would that mean for all of the sinners in this world which must be “ended”? Rather, God gives us time to repent. Later in the book of Hosea we read the words:
“Return, O Israel, to the LORD your God, for you have stumbled because of your iniquity. … O Ephraim, what have I to do with idols? It is I who answer and look after you. I am like an evergreen cypress; from me comes your fruit. Whoever is wise, let him understand these things; whoever is discerning, let him know them; for the ways of the LORD are right, and the upright walk in them, but transgressors stumble in them.” (Hosea 14:1,8-9)
God is jealous for His people, desiring for us to turn from our sins, back to Him. Even at this time in Israel’s history, God tells them to repent.
Justice and mercy go hand in hand. Wars are fought against nations and thousands die for the liberation of an oppressed people. Likewise, it is God's perfect justice and loving mercy to ultimately destroy evil and purify His people. In the New Testament, John the Baptist describes this work of Jesus in the following way...
His winnowing fork is in his hand, and he will clear his threshing floor and gather his wheat into the barn, but the chaff he will burn with unquenchable fire. (Matthew 3:12)