Riyad as-Salihin, Book 1, Hadith 665 (In-Book)

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."[Muslim].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."

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

sunnah.com