With Every Righteous or Wicked Ruler
For while we find countless commands in the Book and the Sunnah establishing the obligation of jihad, we do not find any condition that jihad is to be waged only with a righteous ruler. However, it is necessary in every case that jihad be solely for the sake of raising the word of Allah.
Abu Musa (may Allah be pleased with him) narrated that the Messenger of Allah ﷺ was asked about a man who fights to show courage, and fights out of national pride, and fights for show: which of them is fighting in the way of Allah? So he ﷺ said:
من قاتل لتكون كلمة الله هي العليا فهو فى سبيل الله
“Whoever fights so that the word of Allah is raised high, he is in the way of Allah.”
The following hadiths also support this matter, but they contain weakness.
➊ It is narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah ﷺ said:
الجهاد واجب عليكم مع كل أمير برا كان أو فاجرا وإن هو عمل الكبائر
“Jihad is obligatory upon you with every ruler, whether righteous or sinful, even if he commits major sins.”
➋ It is narrated from Anas (may Allah be pleased with him) that the Messenger of Allah ﷺ said:
ثلاث من أصل الإيمان …. والجهاد ماض منذ بعثني الله إلى أن يقاتل آخر أمتى الدجال لا يبطله جور جائر ولا عدل عادل …
“Three things are from the foundation of faith… and jihad will continue from the time Allah sent me until the last group of my Ummah fights the Dajjal; the tyranny of a tyrant and the justice of a just person cannot nullify it.”
(Ahmad, may Allah have mercy on him): Even if the ruler is known for drinking wine and for betrayal of trust, jihad is still to be waged together with him, because these matters concern his own self, and this hadith is narrated from the Prophet ﷺ:
إن اللـه ليـؤيــد هـذا الدين بالرجل الفاجر
“Allah supports this religion even through a wicked, sinful man.”