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: "It is incumbent on you not to be amazed by (the deeds of) anyone until you see upon what his end is sealed; for a doer does, for a long period of his life or for a span of time, such righteous deeds that if he were to die upon them he would enter Paradise; then he changes and begins doing evil deeds. And indeed, a servant does, for a period of his life, such evil deeds that if he were to die upon them he would enter Hell; then he changes and begins doing righteous deeds. And when Allah Almighty intends good for a servant, He puts him to work (in good deeds)." The Companions (may Allah be pleased with them) said: O Messenger of Allah (peace and blessings be upon him)! How does Allah put him to work? He (peace and blessings be upon him) said: "Allah Almighty grants him the ability to do a righteous deed before death, then takes his soul upon it."
Hadith Referenceمسند أبي يعلى الموصلي / مسند أنس بن مالك / 3840
Hadith Gradingمحدثین:إسناده صحيح على شرط الشيخين
Hadith Takhrij«حکم الحدیث مسند ابی یعلی محققاً تنسیق حسين سليم أسد - مکتبہ شاملہ :قال حسين سليم أسد: إسناده صحيح على شرط الشيخين . » «قال سعيد بن محمد السناري: صحيح: مضى الكلام عليه [برقم 3756]» «أخرجه مسند أحمد برقم: 11804، وأخرجه المستدرك على الصحيحين برقم: 1297، وأخرجه مجمع الزوائد ومنبع الفوائد برقم: 11916، مسند ابویعلیٰ ترقیم الاثری: 3828»