Ubaidullah b Ziyad visited Ma'qil b. Yasir al-Muzani in his last iliness. Ma'qil said (to him): I am narrating to you a tradition I heard from the Messenger of Allah ﷺ. If I knew that I am to survive this illness. I would, not narrate it to you. I heard the Messenger of Allah ﷺ say: If God appointed anyone ruler over a people and he died while he was still treacherous to his people, God would forbid his entry into Paradise. (Using translation from Muslim 142e)
لَهُ مَعْقِلٌ إِنِّي مُحَدِّثُكَ بِحَدِيثٍ سَمِعْتُهُ مِنْ رَسُولِ اللَّهِ ﷺ لَوْ عَلِمْتُ أَنَّ لِي حَيَاةً ما حَدَّثْتُكَ إِنِّي سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ «مَا مِنْ عَبْدٍ يَسْتَرْعِيهِ اللَّهُ رَعِيَّةً يَمُوتُ يَوْمَ يَمُوتُ وَهُوَ غَاشٌّ لِرَعِيَّتِهِ إِلَّا حَرَّمَ اللَّهُ عَلَيْهِ الْجَنَّةَ»