In all of God's dealings with Israel and Judah, and especially regarding the Second Exodus, we see His perfect application of justice and mercy. He is just, because He does not allow their sin to go unpunished. We could not trust God if He did not hold to His promises of blessing and cursing (Numbers 23:19; Leviticus 26; Deuteronomy 28). If He allowed Israel and Judah to sin with impunity, His laws would have no authority, and His words would be of no consequence. However, for the sake of what is best for Jacob, God has to show him that He is serious about what He says. So His justice will be upheld as Israel and Judah are brought to the painful realization that they have forsaken Him and have been living the wrong way.
Yet, we can also see God's mercy in His dealings with His people. Today's Western culture—a product of the nations of Israel—is not so very different from Sodom and Gomorrah. The same sins are committed in the same brazen manner. Our regard for humanity is so low that in America alone during the last three decades, an estimated 40-50 million pre-born children have been killed for the sake of convenience. Further, God has been systematically removed from schools, from government, and from public life. Post-Christian Europe has transgressed even further. Even Jerusalem—the "Holy City"—has an annual "Gay Pride" parade, and is essentially secular.
Despite these atrocious sins, God will not utterly destroy Israel as He did to Sodom and Gomorrah. A number of latter-day prophecies of various peoples—the Edomites, for example—foretell that God will make a complete end of them (Jeremiah 46:28). However, He has chosen not to do this with Israel and Judah, though not because they are righteous in any way.
He will show them mercy because of the promises He made, not because they deserve it. Ezekiel 36 shows this clearly. God repeats several times that He is bringing Israel back for His name's sake, and not for Israel's sake:
"Therefore say to the house of Israel, 'Thus says the Lord GOD: "I do not do this [restoring Israel and blessing the land; verses 6-15] for your sake, O house of Israel, but for My holy name's sake, which you have profaned among the nations wherever you went. And I will sanctify My great name, which has been profaned among the nations, which you have profaned in their midst; and the nations shall know that I am the LORD," says the Lord GOD, "when I am hallowed in you before their eyes. For I will take you from among the nations, gather you out of all countries, and bring you into your own land. . . . Then you will remember your evil ways and your deeds that were not good; and you will loathe yourselves in your own sight, for your iniquities and your abominations. Not for your sake do I do this," says the Lord GOD, "let it be known to you. Be ashamed and confounded for your own ways, O house of Israel!" (Ezekiel 36:22-24, 31-32)
God would be unfaithful to His own promises if He annihilated Jacob's descendants—even though, by all accounts, it is exactly what they deserve.