His statement, “so long as they uphold the religion,” means: for as long as they maintain the affairs of the religion. It implies that if they do not uphold the religion, authority will pass from them. Other hadiths address this; one of them has preceded at (1552), and see the one that follows it. Al-Hafiz alluded to them in his commentary on this hadith (13/117), saying:
“It may be inferred from the rest of the hadiths that authority only passes from them after what Allah first threatened them with has been inflicted upon them—namely, that which brings about abandonment and the corruption of administration. This occurred at the beginning of the Abbasid state. Then came the threat that those who would harm them would be given power over them; this occurred when their clients gained dominance, so that they became like a minor under guardianship, content with his pleasures while another manages his affairs. Then the calamity intensified, and the Daylamites overcame them, constricting them in every respect until nothing remained for the caliph but the sermon. Those who had seized power divided the kingdoms among themselves throughout all the regions. Then one group after another came upon them, until authority was wrested from them in every land, and nothing remained for the caliph but a mere name in some cities.”
I say: How closely the present resembles the past—indeed, the situation is worse. For today they have no caliph, neither in name nor in reality; and Jews, communists, and hypocrites have gained mastery over many Muslim lands. So Allah Most High is the One from whom we ask that He grant the Muslims success in obeying His command in all that He has legislated for them, and inspire their rulers to unite in one state governed by His law, so that Allah may grant them honor in this world and make them happy in the Hereafter. Otherwise, the matter is as Allah Most High says: “Indeed, Allah does not change the condition of a people until they change what is within themselves.”
This is explained in the authentic hadith: “When you engage in ‘inah (sale-and-buyback) transactions, take hold of cows’ tails, are content with agriculture, and abandon jihad in the path of Allah, Allah will impose upon you a humiliation which He will not remove from you until you return to your religion.” (1)
So return to your religion, O Muslims—rulers and subjects alike.