The Messenger of Allah ﷺ said, "There will come rulers whose deeds you will recognize as good and others you will condemn as wrong. Whoever denounces what is wrong is absolved, and whoever hates it in his heart is safe, but the one who is pleased with it and follows along is guilty."The companions asked, "Messenger of Allah, shall we not fight them?"He replied, "Not as long as they perform the five daily prayers among you."
حدثنا يزيد حدثنا هشام بن حسان عن الحسن عن ضبة بن محصن
قال رسول الله ﷺ إنه ستكون أمراء تعرفون وتنكرون فمن أنكر فقد برئ ومن كره فقد سلم ولكن من رضي وتابع قالوا يا رسول الله أفلا نقاتلهم قال لا ما صلوا لكم الخمس
Its isnad is sahih. Dabbah bin Mihsan is Anazi, and he is trustworthy, his hadith appears in Muslim. The hadith was narrated by Muslim, 3/1480, no. 1854, in the book of Leadership, Abu Dawud in the book of Sunnah, 4/242, no. 4760, Tirmidhi, 4/529, no. 2265, where he said, hasan sahih, in the book of Tribulations, and Tabarani in Al-Kabir, 23/330, no. 760.