The town of Nineveh is the only populace that survived impending disaster (ordained by Allah), when they came back from the edge of a precipice. The Quran confirms this in Surah Yunus (10:98). These events seemingly taking place in the 8th century BC.
Nineveh lived an existence of excesses and to it came Hazrat Yunus as Prophet. For thirty plus years he endeavoured to teach them, but truth be told had scanty success, with only a handful of conversions. His warnings of the wrath of Allah made no difference and they ridiculed him. Eventually his patience ran out and he told them he is leaving Nineveh and punishment will follow. Alas, Yunus(as) was supposed to ask Allah for his directions and not go off in anger.
Remember Dhan Nun (Yunus), when he went off in anger, and imagined that We shall not punish him (21:87)
When Hazrat Yunus left the town, the skies changed colour and dark clouds and rumblings appeared overhead. The people now fearful, gathered and implored Allah for His forgiveness. Since their repentance was sincere Allah withdrew his punishment. The storm was lifted, and the people now prayed for the return of Yunus(as) for proper guidance.
Yunus (as) on leaving the town, boarded a ship and it sailed off into the sea. But by night-time the sea became turbulent and a storm tossed and rocked the ship, as if to break it up. This was no ordinary storm and despite baggage being thrown overboard it did not help. A sacrifice was necessary according to sea faring superstitions. Lots were drawn and Yunus(as) name came up. And so the Prophet Yunus dived into a dark stormy sea, with no support in the world but our Allah.
In these stormy waters, a struggling Yunus(as) was miraculously swallowed by a very large fish (lots of disputes on the type of fish. Suffice to say Allah, the Qadir, caused this to happen). Enveloped in darkness, inside a fish, immersed in its digestive juices and with no hope. There can not have been a worse position of any human in history. Even Hazrat Ibrahim in the fire was out in the open, where he could see and had faith Allah will save him. In desperation, totally repentant and knowing Allah was there, Yunus (as) said the very famous words of Ayat Karima.
"La ilaha illa anta subhanaka, inni kuntu minaz zalimeen."
There is no god but You. Glory be to You! I have done wrong. (21:87)
Allah is Rehman and Rahim and heard the sincere repentance of Yunus(as) and commanded the fish to eject him onto land. Once ejected on land, he was weak and his skin burning. A gourd tree grew over him and Yunus(as) was able to feed from it, and had shelter against the elements. Allah (swt) informed him that without repentance he would have stayed in the fish's stomach till the Day of Judgment. Instead due to repentance and Allah's mercy, Yunus (as) went back to Nineveh to a people who were waiting for him.
And We sent him to a hundred thousand people or even more, and they believed; so We gave them enjoyment for a while. (37:147-148 )
The Ayat Karima ( as we know it in Pakistan) is one of the most powerful supplications to Allah (swt), during desperate times. The Prophet (saw) has stated in a Hadith.
“I know words that will cause Allah to remove one’s distress. These are the words (of supplication) of my brother Yunus (as).” (Tirmidhi)
Of all the legacies of Hazrat Yunus, this is the one, that almost three thousand years later, over a billion people repeat his words to Allah (swt) in times of repentance, sorrow and need.