Ibn Abbas (may Allah be pleased with them both) narrates from the Prophet (peace and blessings be upon him): "Whoever appoints an official over the Muslims while knowing that among them is someone more deserving of it than him, and more knowledgeable of the Book of Allah and the Sunnah of His Prophet, has betrayed Allah, His Messenger and all the Muslims."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20364