Sayyiduna Abd al-Rahman bin Samurah (may Allah be pleased with him) said that the Prophet (peace and blessings be upon him) said: "O Abu Abd al-Rahman! Do not ask for leadership. If it is given to you because you asked for it, you will be left to it; if it comes to you without asking, you will be helped. If you swear an oath to do something and another thing is better than it, then expiate your oath and do what is better."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20247