There's a Sahih hadith saying:
I heard Allah's Apostle (ﷺ) as saying. Every servant would be raised (in the same very state) in which he dies. (Sahih Muslim)
Imam an-Nawawi commented it in his commentary on Sahih Muslim -see here in Arabic- saying:
here and in the following I'll be translating from Arabic language as these translations are of my own take them carefully!
قال العلماء : معناه : يبعث على الحالة التي مات عليها ، ومثله الحديث الآخر بعده ثم بعثوا على نياتهم .
The scholars said: Its meaning is: He resurrects the condition or state in which he died, and the same applies to the other hadith after him, then they were sent on their intentions.
Imam Muslim compiled this hadith in his Sahih in a chapter entitled: "Chapter: The Command To Think Positively Of Allah At The Time Of Death".
And he compiled it after the following hadith:
I heard Allah's Messenger (ﷺ) say three days before his death: None of you should die but hoping only good from Allah, the Exalted and Glorious. (Sahih Muslim)
See also in Sahih Muslim.
Another Sahih hadith warns us from the last deed:
"(as regards your creation), every one of you is collected in the womb of his mother for the first forty days, and then he becomes a clot for another forty days, and then a piece of flesh for another forty days. Then Allah sends an angel to write four items: He writes his deeds, time of his death, means of his livelihood, and whether he will be wretched or blessed (in religion). Then the soul is breathed into his body. So a man may do deeds characteristic of the people of the (Hell) Fire, so much so that there is only the distance of a cubit between him and it, and then what has been written (by the angel) surpasses, and so he starts doing deeds characteristic of the people of Paradise and enters Paradise. Similarly, a person may do deeds characteristic of the people of Paradise, so much so that there is only the distance of a cubit between him and it, and then what has been written (by the angel) surpasses, and he starts doing deeds of the people of the (Hell) Fire and enters the (Hell) Fire."
(Sahih al-Bukhari see for example here and Sahih Muslim and elsewhere)
On the other hand we find:
"When Allah wants good for a slave, He puts him in action." It was said: "How does he put him in action O Messenger Of Allah?" He said: "By making him meet up with the righteous deeds before death." (Jami' at-Tirmidhi and also in Musnad Ahmad)
Why should we only hope good? And why are these ahadith warning us?
Scholars say a good Muslim lives between "fear" and "hope". The fear of being punished in the hereafter and the hope for Allah's forgiveness. The fear should make us fear to disobey and do more good deeds at the end of our days and the hope should help us to never despair, Allah the Almighty says:
Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah . Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful." (39:53)
More details on the bad and good end
In the following I'll quote some known bad endings from both qur'an and sunnah after analyzing the first hadith in more details:
The scholars differed on the meaning of:
Every servant would be raised in which he dies.
Some considered it related to shrouds one was wearing when buried. Others said this only applies to the martyr (based on the Sahih hadith) and again others said it applies to both martyr and haaj or a person wearing Ihraam (Based on the Sahih hadith).
Another view is that it applies to every human as imam an-Nawawi only indicated. al-Munawy المناوي said in his Fayd al-Qadyr فيض القدير (commentary on al-Jami' as-Saghir of imam as-Suyuti) on the topic:
إن ما يفعله العبد من خير وشر في هذه الدار له نتائج تظهر في دار البقاء لأنها محل الجزاء وجزاء كل إنسان بحسب عمله وكل معروف أو منكر يجازى عليه من جنسه وكل إنسان يحشر على ما كان عليه في الدنيا ولهذا ورد أن كل إنسان يحشر على ما مات عليه.
What a servant does in terms of good and evil in this house (life) has consequences that appear in the hereafter because it is the subject of the penalty and the reward for every person according to his deeds, and every known or unrepentant person will be rewarded of his kind, and every person is crammed into what he was in this world, and for this it is reported that every person is cornered For what he died.
And in the same book he analyzed our hadith saying:
Please not that I'll only refer to the hadith of Sunan abi Dawod mentioned here without typing the translation
(يبعث كل عبد على ما مات عليه) أي على الحال التي مات عليها من خير وشر قال الهروي: وليس قول من ذهب به إلى الأكفان بشيء لأن الإنسان إنما يكفن بعد الموت
(Every servant would be raised in which he dies.) That is, in the case in which he died of good and evil. Al-Harawi said: The saying of the one who took him to the shrouds is nothing because a person is shrouded after death.
ثم هذا الحديث يوضحه حديث أبي داود عن ابن عمر وقيل: يا رسول الله أخبرني عن الجهاد والغزو قال: إن قتلت صابرا محتسبا بعثت صابرا محتسبا وإن قتلت مرائيا مكاثرا بعثت مرائيا مكاثرا على أي حال قاتلت أو قتلت بعثك الله بتلك الحال
This hadith is explained by the hadith of abi Dawod
وفي حديث أبي هريرة عن أنس مرفوعا من مات سكرانا فإنه يعاين ملك الموت سكرانا ويعاين منكرا ونكيرا سكرانا ويبعث يوم القيامة سكرانا إلى خندق في وسط جهنم يسمى السكران
And in the hadith of Abu Huraira on the authority of Anas, a man who died drunk, will see the angel of death drunk, see Munkar and Nakeer drunk, and on the Day of Resurrection he will raised drunk into a trench in the middle of Jahannam called the drunk (Sakraan) This hadith was compiled by Ismael al-Asbahany إسماعيل الأصبهاني -died 535 a.H.- in his at-Targheeb wa at-Tarheeb li qawaami as-Sunnah كتاب الترغيب والترهيب لقوام السنة
قال عياض: أورد مسلم هذا الحديث عقب حديث لا يموتن أحدكم إلا وهو يحسن الظن بالله مشيرا إلى أنه مفسر له ثم أعقبه بحديث ثم بعثوا على أعمالهم مشيرا إلى أنه وإن كان مفسرا لما قبله لكنه عام فيه وفي غيره
Qady 'Iyad said: Muslim narrated this hadith after the hadith that "none of you should die but hoping only good from Allah", indicating that it was explaining it, then he followed it with the hadith, "then they would be raised according to their deeds", indicating that even if it was an explanation of what came before it, it is general in it and elsewhere.
We learnt so far that people with a good ending such as haaj (or a person wearing Ihram) and a martyr could be regarded as good endings. A rather unqualified hadith mentioned on the bad ending of a drunk person.
Here some known bad endings
- Betrayers we read in the qur'an about people who do treachery and betray:
It is not [attributable] to any prophet that he would act unfaithfully [in regard to war booty]. And whoever betrays, [taking unlawfully], will come with what he took on the Day of Resurrection. Then will every soul be [fully] compensated for what it earned, and they will not be wronged. (3:161)
Ibn Kathir mentioned in his tafsir:
(and whosoever is deceitful with the booty, he shall bring forth on the Day of Resurrection that which he took. Then every person shall be paid in full what he has earned, and they shall not be dealt with unjustly.)
This Ayah contains a stern warning and threat against Ghulul )stealing from the booty(, and there are also Hadiths, that prohibit such practice. Imam Ahmad recorded that Abu Malik Al-Ashja'i said that the Prophet said,
(The worst Ghulul (i.e. stealing) with Allah is a yard of land, that is, when you find two neighbors in a land or home and one of them illegally acquires a yard of his neighbor's land. When he does, he will be tied with it from the seven earths until the Day of Resurrection.)
He further quoted this Sahih hadith and then this one.
Imam al-Qurtobi commented -see here- in Arabic:
ومن يغلل يأت بما غل يوم القيامة أي يأتي به حاملا له على ظهره ورقبته ، معذبا بحمله وثقله ، ومرعوبا بصوته ، وموبخا بإظهار خيانته على رءوس الأشهاد
(And whoever betrays, [taking unlawfully], will come with what he took on the Day of Resurrection) That is, he brings him carrying him on his back and neck, tormented by his burden and his weight, terrified by his voice, and reproached for showing his betrayal on the heads of witness.
- People dealing with Riba. Allah says:
Those who consume interest cannot stand [on the Day of Resurrection] except as one stands who is being beaten by Satan into insanity. (2:275)
- Another betrayer: breach of faith:
When Allah will gather together, on the Day of Judgment, all the earlier and later generations of mankind, a flag will be raised (to mark off) every person guilty of breach of faith, and it will be announced that this is the perfidy of so and so, son of so and so (to attract the attention of people to his guilt). (Sahih Muslim, see also in Sahih Muslim)
Some further sources:
- Explanation of the intro hadith islamweb fatwa #63546 in Arabic.
- How people will be resurrected article on alukha -in Arabic-
- In fatwa islamqa #10903 you may find some signs of a good end.
Does a bad end means punishment in the hereafter?
Even if we by now could tell that (at least some) people would be resurrected in the state they died in. No matter if this person did this sin intentionally or not, or whether he asked for forgiveness or not. The view of ahl-as-Sunnah wal-Jama'a is that none could neither affirm nor confirm that people who die doing a sin (without repenting from it) would be punished, but the matter is up to Allah He may forgive or may punish.
Allah says about people who do small sins or single sins:
Those who avoid the major sins and immoralities, only [committing] slight ones. Indeed, your Lord is vast in forgiveness. ... (53:32)
This is because the more one repeats a sin the worse it becomes and the more it becomes an attitude.
And Allah further says:
Indeed, Allah does not do injustice, [even] as much as an atom's weight; while if there is a good deed, He multiplies it and gives from Himself a great reward. (4:40)