The city of Ninveh was so wicked that G-d instructed the prophet Yonah to go there and announce its impending destruction (See Jonah 1). After some escapades in the deep sea, Yonah came to Ninveh and informed the city and the king of G-d’s prophecy. The king immediately decreed that “Neither man nor beast, neither cattle nor sheep, shall taste anything; they shall not graze, neither shall they drink water. And they shall cover themselves with sackcloth, both man and beast, and they shall call mightily to G-d, and everyone shall repent of his evil way and of the dishonest gain which is in their hands.” G-d accepted their teshuvah as it says, “G-d saw their deeds, that they had repented of their evil way, and the L-rd relented concerning the evil that He had spoken to do to them, and He did not do it.”
Even a Temporary Teshuvah
The people of Ninveh eventually reverted back to their evil ways and were once again deserving of destruction. (Later on, they were active participants in the destruction of the First Beit HaMikdash.) As a result of their sins, several decades after the story of Jonah, Ninveh was sacked and destroyed by the emerging Babylonian empire (Pirkei DeRabi Eliezer 43). G-d, who is omniscient, certainly knew that the inhabitants of Ninveh would backslide. Nevertheless, since in Yonah’s time their intentions were good, he accepted their teshuvah and forgave them. We learn from this that if a person does sincere teshuvah, it will be accepted even if in the future he may not maintain it.