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."
Arabic/English book reference: Book 1, Hadith 665