17إِنَّمَا ٱلتَّوْبَةُ عَلَى ٱللَّهِ لِلَّذِينَ يَعْمَلُونَ ٱلسُّوٓءَ بِجَهَـٰلَةٍ ثُمَّ يَتُوبُونَ مِن قَرِيبٍ فَأُو۟لَـٰٓئِكَ يَتُوبُ ٱللَّهُ عَلَيْهِمْ ۗ وَكَانَ ٱللَّهُ عَلِيمًا حَكِيمًا
18وَلَيْسَتِ ٱلتَّوْبَةُ لِلَّذِينَ يَعْمَلُونَ ٱلسَّيِّـَٔاتِ حَتَّىٰٓ إِذَا حَضَرَ أَحَدَهُمُ ٱلْمَوْتُ قَالَ إِنِّى تُبْتُ ٱلْـَٔـٰنَ وَلَا ٱلَّذِينَ يَمُوتُونَ وَهُمْ كُفَّارٌ ۚ أُو۟لَـٰٓئِكَ أَعْتَدْنَا لَهُمْ عَذَابًا أَلِيمًا
[17-18] However note it well that Allah's acceptance of repentance is for those people only, who commit an evil in ignorance, and then repent of it soon after this. Allah again turns kindly to such people, for Allah is All-Knowing, All-Wise. But there is no repentance for those people who persist in their evil deeds until the dying hour comes to anyone of them; then he says, "Now I repent." Nor is repentance for them who die as unbelievers; for such people, We have prepared a painful torment.27
27The word taubah means 'to turn back' and 'to turn to'. When a person feels sorry for his sin and turns back from it, he may be likened to a runaway slave who comes back to his master. This is his taubah. When the master accepts his repentance, he turns to him kindly and forgives him. In Arabic this is his taubah to his servant. In this verse Allah has stated these two aspects of taubah. He says, "I turn only to those servants of Mine, who, if they commit some un-intentional sin through ignorance, turn to Me for forgiveness as soon as they realize their folly. For such repentance, the door of My forgiveness is ever open. It is, however, not so for those who persist in sin throughout their lives without the least fear of Allah and offer repentance only when death confronts them". The Holy Prophet says that Allah accepts the repentance of a person only up to the time, when there appears no sign of death. It is obvious that after the time of test has expired, no chance is left for him to turn back from sin. Likewise, if a person is dying as a disbeliever and seeing with his own eyes the other world, contrary to his expectations, the question of his repentance does not arise at all.