Language:
كتاب الأحكام
93  
Judgments (Ahkaam)
(5)
Chapter: Allah will surely help him in ruling who….
(5)
باب مَنْ لَمْ يَسْأَلِ الإِمَارَةَ أَعَانَهُ اللَّهُ
Sahih al-Bukhari 7146

Narrated `Abdur-Rahman bin Samura:

The Prophet (ﷺ) said, "O `Abdur-Rahman! Do not seek to be a ruler, for if you are given authority on your demand then you will be held responsible for it, but if you are given it without asking (for it), then you will be helped (by Allah) in it. If you ever take an oath to do something and later on you find that something else is better, then you should expiate your oath and do what is better."

حَدَّثَنَا حَجَّاجُ بْنُ مِنْهَالٍ، حَدَّثَنَا جَرِيرُ بْنُ حَازِمٍ، عَنِ الْحَسَنِ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ سَمُرَةَ، قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏ "‏ يَا عَبْدَ الرَّحْمَنِ لاَ تَسْأَلِ الإِمَارَةَ، فَإِنَّكَ إِنْ أُعْطِيتَهَا عَنْ مَسْأَلَةٍ وُكِلْتَ إِلَيْهَا، وَإِنْ أُعْطِيتَهَا عَنْ غَيْرِ مَسْأَلَةٍ أُعِنْتَ عَلَيْهَا، وَإِذَا حَلَفْتَ عَلَى يَمِينٍ فَرَأَيْتَ غَيْرَهَا خَيْرًا مِنْهَا، فَكَفِّرْ يَمِينَكَ، وَأْتِ الَّذِي هُوَ خَيْرٌ ‏"‏‏.‏
Reference : Sahih al-Bukhari 7146
In-book reference : Book 93, Hadith 10
USC-MSA web (English) reference : Vol. 9, Book 89, Hadith 260
  (deprecated numbering scheme)