'Auf bin Malik (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "The best of your rulers are those whom you love and who love you, and those who supplicate Allah in your favour and you supplicate Allah in their favour. The worst of your rulers are those whom you hate and who hate you; and whom you curse and who curse you." It was asked (by those who were present): "Should not we oppose them?" He said, "No, as long as they establish Salat; as long as they establish Salat in your midst."[Muslim].
Arabic/English book reference: Book 1, Hadith 661