Sahih al-Bukhari, Hadith 6622

Narrated `Abdur-Rahman bin Samura: The Prophet said, "O `Abdur-Rahman bin Samura! Do not seek to be a ruler, because if you are given authority for it, then you will be held responsible for it, but if you are given it without asking for it, then you will be helped in it (by Allah): and whenever you take an oath to do something and later you find that something else is better than the first, then do the better one and make expiation for your oath."

حَدَّثَنَا أَبُو النُّعْمَانِ، مُحَمَّدُ بْنُ الْفَضْلِ حَدَّثَنَا جَرِيرُ بْنُ حَازِمٍ، حَدَّثَنَا الْحَسَنُ، حَدَّثَنَا عَبْدُ الرَّحْمَنِ بْنُ سَمُرَةَ، قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏ "‏ يَا عَبْدَ الرَّحْمَنِ بْنَ سَمُرَةَ لاَ تَسْأَلِ الإِمَارَةَ، فَإِنَّكَ إِنْ أُوتِيتَهَا عَنْ مَسْأَلَةٍ وُكِلْتَ إِلَيْهَا، وَإِنْ أُوتِيتَهَا مِنْ غَيْرِ مَسْأَلَةٍ أُعِنْتَ عَلَيْهَا، وَإِذَا حَلَفْتَ عَلَى يَمِينٍ فَرَأَيْتَ غَيْرَهَا خَيْرًا مِنْهَا، فَكَفِّرْ عَنْ يَمِينِكَ، وَأْتِ الَّذِي هُوَ خَيْرٌ ‏" ‏‏.‏

sunnah.com