Mishkat al-Masabih
The Offices of Commander and Qadi — Hadith #3543
وَعَنْ غَالِبٍ الْقَطَّانِ عَنْ رَجُلٍ عَنْ أَبِيهِ عَنْ جَدِّهِ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم: «إِن العرافة حق ولابد لِلنَّاسِ مِنْ عُرَفَاءَ وَلَكِنَّ الْعُرْفَاءَ فِي النَّارِ» . رَوَاهُ أَبُو دَاوُد
Ghalib al-Qattan quoted a man who stated on the authority of his father that his grandfather reported God’s Messenger as saying, “The office of a chief is necessary, for people must have chiefs, but the chiefs will go to hell.”*
Abu Dawud transmitted it.
* Mirqat. iv, 133 says this means those who are unjust, or is a warning against the temptations to injustice arising from their office.