Abu Hurairah reported,

We were with the Messenger of Allah ﷺ at Khaybar when he said about a man who claimed to be a Muslim, "This man is among the people of the Fire."When the battle began, that man fought fiercely until he was wounded. Someone said, "Messenger of Allah, the man you said was among the people of the Fire fought fiercely today and has now died."The Prophet ﷺ said, "He is in the Fire."Some of the people nearly began to doubt. While they were in that state, word came that the man had not actually died but was severely wounded. When night came, he could not endure the pain of his wounds and took his own life.The Prophet ﷺ was informed of this and said, "Allahu Akbar. I bear witness that I am the servant of Allah and His Messenger."Then he ordered Bilal to announce to the people, "None shall enter Paradise except a Muslim soul, and indeed Allah supports this religion even through a wicked man."

Azami 6828

Sahih

عن أبي هريرة قال

شهدنا مع رسول الله ﷺ خيبر فقال لرجل ممن يدعي الإسلام: هذا من أهل النار فلما حضر القتال قاتل الرجل قتالا شديدا، فأصابته جراحة فقيل: يا رسول الله: الذي قلت إنه من أهل النار، فإنه قد قاتل اليوم قتالا شديدا وقد مات؟ فقال النبي ﷺ: إلى النار قال: فكاد بعض الناس أن يرتاب فبينما هم على ذلك إذ قيل: إنه لم يمت ولكن به جراحا شديدا، فلما كان من الليل لم يصبر على الجراح فقتل نفسه، فأخبر النبي ﷺ و بذلك فقال: الله أكبر أشهد أني عبد الله ورسوله ثم أمر بلالا فنادى بالناس: إنه لا يدخل الجنة إلا نفس مسلمة، وإن الله ليؤيد هذا الدين بالرجل الفاجر.

الأعظمي 6828صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Retaliation and crimes
Chapter
Prohibition of protected blood
Section
Severity of the prohibition of a person killing himself
Numbering
Jami al-Kamil 6828 (2nd edition)
Azami 6828