Nineveh, at the start of the 8th century B.C., was a large metropolis in the expanding Assyrian Empire. The city's wicked behavior eventually drew God's attention (Jonah 1:2). Unlike Sodom and Gomorrah, God was willing to extend his grace and offer the city a chance to be saved by sending them a prophet. Jonah was charged with warning "the great city" (4:11) of its impending destruction.
The fact that Nineveh received grace to be saved is truly amazing when one considers it was founded by Nimrod, a man who actively and openly opposed the Eternal (Genesis 10:8 - 11)!
Various Bible commentaries state the city's population, at the time of Jonah, was anywhere from 120,000 people (Jonah 4:11) to estimates of 600,000 and more. Research carried out on ancient populations suggests that Nineveh, in the fifty-six years before its destruction in 612 B.C., was the most populated area in the world.
Jonah, albeit reluctantly, warned Nineveh that God's judgment was rapidly approaching (Jonah 4:4). The city's response to the grace offered them was immediate. Everyone, including the animals, began to fast. The king, who also fasted, commanded that the people turn from their evil ways in the hope that they still might be saved (3:5 - 9).
The repentance of those in Nineveh caused the Eternal to forestall their destruction. Nineveh's response to God's grace was so noteworthy that Jesus used them as an example of how people should respond to him (Matthew 12:41).
The Assyrian Empire strikes back
In 723 B.C., the mighty Assyrian Empire (arguably the world's first superpower) conquered and took captive the northern ten tribes of Israel (Kingdom of Israel). In 701, under King Sennacherib, it set its sight on the Kingdom of Judah. Sennacherib quickly subdued many of Judah's cities (2Kings 18:13) then marched his troops towards its capital of Jerusalem.
The situation for Judah was dire, as righteous King Hezekiah did not have the military strength to stop Assyria's 185,000 troops, who now surrounded Jerusalem, from overrunning and destroying it. After receiving Sennacherib's letter demanding he surrender (Isaiah 37:9 - 13), Hezekiah humbled himself in prayer with the hope that the city might be saved by God's grace (2Kings 19:14 - 19).
The Lord's grace toward Hezekiah and what it motivated him to do is one of the most awesome answers to prayer in Scripture! He sent the Angel of the Lord who, when night fell, saved all those in Jerusalem by killing the entirety of Sennacherib's army (2Kings 19:35 - 37). The shocked Assyrian ruler quickly turned and went home where he was soon assassinated by two of his sons (verse 37).
Saved at the last minute
Even the righteous sometimes commit sins that warrant the need for God's amazing grace in order to avoid themselves, or others, being put to death. Two classic examples of this principle in action, and how mercy saved people from destruction, occurred in the life of King David.
David's need for grace, so that he could be saved from death, happened after his adultery with Bathsheba and arranged killing of Uriah (2Samuel 11, 12). Although what he did was punishable, in God's law, by the death penalty (Exodus 21:12 - 14, Leviticus 20:10, etc.), Nathan the prophet tells him "The Lord also has put away your sin; YOU SHALL NOT DIE" (verse 13).
King David was saved from death because he quickly admitted his sin and the Lord's grace took into account his heart of repentance (see Psalm 51).
David required another big dose of grace after he committed the sin of commanded a census of Israel's fighting men. After confronted about his sin, the king chooses (out of three punishments the Lord offered) a three-day long deadly epidemic upon the entire land.
After the death angel kills 70,000 Israelite men God tells him to pause just before entering Jerusalem (2Samuel 24). David sees the angel and pleads for the Lord's grace so that the lives of those remaining be saved. He then builds an altar where the angel paused and offers sacrifices. The slaughter of the people then ends.