كتاب الإيمان
1  
The Book of Faith
(47)
Chapter: Clarifying the emphatic prohibition against killing oneself; The one who kills himself with something will be punished with it in the fire; And that no one will enter Paradise but a muslim
(47)
باب غِلَظِ تَحْرِيمِ قَتْلِ الإِنْسَانِ نَفْسَهُ وَإِنَّ مَنْ قَتَلَ نَفْسَهُ بِشَيْءٍ عُذِّبَ بِهِ فِي النَّارِ وَأَنَّهُ لاَ يَدْخُلُ الْجَنَّةَ إِلاَّ نَفْسٌ مُسْلِمَةٌ
Sahih Muslim 112

It is reported on the authority of Sahl b. Sa'd al-Sa'idi that there was an encounter between the Messenger of Allah (ﷺ) and the polytheists, and they fought (against one another). At the conclusion of the battle the Messenger of Allah (ﷺ) bent his steps towards his army and they (the enemies) bent their steps towards their army. And there was a person (his name was Quzman and he was one of the hypocrites) among the Companions of the Messenger of Allah (ﷺ) who did not spare a detached (fighter of the enemy) but pursued and killed him with the sword. They (the Companions of the Holy Prophet) said:

None served us better today than this man Upon this the Messenger of Allah (ﷺ) remarked: Verily he is one of the denizens of Fire. One of the people (Muslims) said: I will constantly shadow him. Then this man went out along with him. He halted whenever he halted, and ran along with him whenever he ran. He (the narrator) said: The man was seriously injured. He (could not stand the pain) and hastened his own death. He placed the blade of the sword on the ground with the tip between his chest and then pressed himself against the sword and killed himself. Then the man (following him) went to the Messenger of Allah (ﷺ) and said: I bear testimony that verily thou art the Messenger of Allah, He (the Holy Prophet) said: What is the matter? He replied: The person about whom you just mentioned that he was one among the denizens of Fire and the people were surprised (at this) and I said to them that I would bring (the news about him) and consequently I went out in search of him till I (found him ) to be very seriously injured. He hastened his death. He placed the blade of the sword upon the ground and its tip between his chest and then pressed himself against that and killed himself. Thereupon the Messenger of Allah (ﷺ) remarked: A person performs the deeds which to the people appear to be the deeds befitting the dweller of Paradise, but he is in fact one of the denizens of Hell. And verily a person does an act which in the eyes of public is one which is done by the denizens of Hell, but the person is one among the dwellers of Paradise.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا يَعْقُوبُ، - وَهُوَ ابْنُ عَبْدِ الرَّحْمَنِ الْقَارِيُّ - حَىٌّ مِنَ الْعَرَبِ - عَنْ أَبِي حَازِمٍ، عَنْ سَهْلِ بْنِ سَعْدٍ السَّاعِدِيِّ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم الْتَقَى هُوَ وَالْمُشْرِكُونَ فَاقْتَتَلُوا ‏.‏ فَلَمَّا مَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم إِلَى عَسْكَرِهِ وَمَالَ الآخَرُونَ إِلَى عَسْكَرِهِمْ وَفِي أَصْحَابِ رَسُولِ اللَّهِ صلى الله عليه وسلم رَجُلٌ لاَ يَدَعُ لَهُمْ شَاذَّةً إِلاَّ اتَّبَعَهَا يَضْرِبُهَا بِسَيْفِهِ فَقَالُوا مَا أَجْزَأَ مِنَّا الْيَوْمَ أَحَدٌ كَمَا أَجْزَأَ فُلاَنٌ ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ أَمَا إِنَّهُ مِنْ أَهْلِ النَّارِ ‏"‏ ‏.‏ فَقَالَ رَجُلٌ مِنَ الْقَوْمِ أَنَا صَاحِبُهُ أَبَدًا ‏.‏ قَالَ فَخَرَجَ مَعَهُ كُلَّمَا وَقَفَ وَقَفَ مَعَهُ وَإِذَا أَسْرَعَ أَسْرَعَ مَعَهُ - قَالَ - فَجُرِحَ الرَّجُلُ جُرْحًا شَدِيدًا فَاسْتَعْجَلَ الْمَوْتَ فَوَضَعَ نَصْلَ سَيْفِهِ بِالأَرْضِ وَذُبَابَهُ بَيْنَ ثَدْيَيْهِ ثُمَّ تَحَامَلَ عَلَى سَيْفِهِ فَقَتَلَ نَفْسَهُ فَخَرَجَ الرَّجُلُ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ أَشْهَدُ أَنَّكَ رَسُولُ اللَّهِ ‏.‏ قَالَ ‏"‏ وَمَا ذَاكَ ‏"‏ ‏.‏ قَالَ الرَّجُلُ الَّذِي ذَكَرْتَ آنِفًا أَنَّهُ مِنْ أَهْلِ النَّارِ فَأَعْظَمَ النَّاسُ ذَلِكَ فَقُلْتُ أَنَا لَكُمْ بِهِ فَخَرَجْتُ فِي طَلَبِهِ حَتَّى جُرِحَ جُرْحًا شَدِيدًا فَاسْتَعْجَلَ الْمَوْتَ فَوَضَعَ نَصْلَ سَيْفِهِ بِالأَرْضِ وَذُبَابَهُ بَيْنَ ثَدْيَيْهِ ثُمَّ تَحَامَلَ عَلَيْهِ فَقَتَلَ نَفْسَهُ ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم عِنْدَ ذَلِكَ ‏"‏ إِنَّ الرَّجُلَ لَيَعْمَلُ عَمَلَ أَهْلِ الْجَنَّةِ فِيمَا يَبْدُو لِلنَّاسِ وَهُوَ مِنْ أَهْلِ النَّارِ وَإِنَّ الرَّجُلَ لَيَعْمَلُ عَمَلَ أَهْلِ النَّارِ فِيمَا يَبْدُو لِلنَّاسِ وَهُوَ مِنْ أَهْلِ الْجَنَّةِ ‏"‏ ‏.‏
Reference : Sahih Muslim 112
In-book reference : Book 1, Hadith 213
USC-MSA web (English) reference : Book 1, Hadith 206
  (deprecated numbering scheme)