عَنْ أَنَسِ بْنِ مَالِكٍ رَضِيَ اللَّهُ عَنْهُ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ قَالَ: ((لَا عَلَيْكُمْ أَنْ لَا تُعْجَبُوا بِأَحَدٍ حَتَّى تَنْظُرُوا بِمَا يُخْتَمُ لَهُ، فَإِنَّ الْعَامِلَ يَعْمَلُ زَمَانًا طَوِيلًا مِنْ عُمُرِهِ أَوْ بُرْهَةً مِنْ دَهْرِهِ بِعَمَلٍ صَالِحٍ لَوْ مَاتَ عَلَيْهِ دَخَلَ الْجَنَّةَ، ثُمَّ يَتَحَوَّلُ فَيَعْمَلُ عَمَلًا سَيِّئًا، وَإِنَّ الْعَبْدَ لَيَعْمَلُ الْبُرْهَةَ مِنْ دَهْرِهِ بِعَمَلٍ سَيِّئٍ لَوْ مَاتَ عَلَيْهِ دَخَلَ النَّارَ ثُمَّ يَتَحَوَّلُ فَيَعْمَلُ عَمَلًا صَالِحًا، وَإِذَا أَرَادَ اللَّهُ بِعَبْدٍ خَيْرًا اِسْتَعْمَلَهُ قَبْلَ مَوْتِهِ)) قَالُوا: يَا رَسُولَ اللَّهِ! وَكَيْفَ يَسْتَعْمِلُهُ؟ قَالَ: ((يُوَفِّقُهُ لِعَمَلٍ صَالِحٍ ثُمَّ يَقْبِضُهُ عَلَيْهِ))
It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "There is no harm upon you in not being pleased with someone (due to their good deeds), until you see upon which deed their end occurs. The reason for this is that a person may perform such righteous deeds for a long part of his life or for some time, that if he were to die upon them, he would enter Paradise. But it happens that he changes his routine and begins to do evil deeds. Similarly, a man may continue to do such evil deeds for some time that if he were to die in that state, he would enter Hell. But then he changes and begins to do good deeds. And when Allah Almighty intends good for a servant, He uses him before his death." The Companions said: "O Messenger of Allah! How does He use him?" He (peace and blessings be upon him) said: "Allah Almighty grants him the ability to do good deeds, and then causes him to die upon that (good deed)."