Throughout history the righteous scholars of the Sunni way have cautioned against becoming too close with unrighteous rulers. At the same time, sometimes the greater good entails that some scholars deal with even unjust or oppressive rulers in order to lessen their injustice or oppression, if only in limited ways. It is a question of lessening harm to the extent possible and trying to achieve any limited benefits for Muslims and society at large.