Hadithcore
Riyad as-Salihin, 664

Ibn 'Umar (May Allah be pleased with them) reported:

Messenger of Allah (ﷺ) said, "One who withdraws his hand from obedience (to the Amir) will find no argument (in his defense) when he stands before Allah on the Day of Resurrection; and one who dies without having sworn allegiance will die the death of one belonging to the Days of Ignorance." <b>[Muslim]</b>. Another narration is: The Messenger of Allah (ﷺ) said, "He who dies having defected from obedience (to the Amir) and discards his association with the main body of the (Muslim) community, dies the death of one belonging to the Days of Jahiliyyah."

وعنه قال‏:‏ سمعت رسول الله صلى الله عليه وسلم يقول “من خلع يداً من طاعة لقي الله يوم القيامة ولا حجة له، ومن مات وليس في عنقه بيعة مات ميتة جاهلية” ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏ وفي رواية له‏:‏ “ومن مات وهو مفارق للجماعة، فإنه يموت ميتة جاهلية” ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏ وفي رواية له‏:‏ “ومن مات وهو مفارق للجماعة، فإنه يموت ميتة جاهلية”‏.‏

References1 variant
In-Book Reference
Introduction, Hadith 664
Sharh · explanationclick to expand
<b>Guidance from the Hadith:</b><br> 1) The obligation to adhere to the Muslim community and give the pledge of allegiance to their leader; and the prohibition of revolting against the legitimate ruler.<br> 2) The immense importance of the pledge of allegiance, given the interests achieved by it; and the warning against breaking it, given the resultant evils.