Abu Hurairah reported,

The Prophet ﷺ said, "Whoever withdraws his obedience and separates from the community, then dies, dies the death of pre-Islamic ignorance. Whoever fights under a blind banner, becoming angry for the sake of tribal partisanship, or calling to tribal partisanship, or supporting tribal partisanship, and is killed, his death is the death of pre-Islamic ignorance. Whoever rebels against my nation, striking its righteous and its wicked alike, sparing none of its believers and honoring no covenant with one who holds a pledge, is not of me, and I am not of him."

Azami 7664

Sahih

عن أبي هريرة

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

الأعظمي 7664صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Leadership
Section
Sin of one who dies without having given a pledge of allegiance
Numbering
Jami al-Kamil 7664 (2nd edition)
Azami 7664