mother, or a commander—whether his authority is broad or restricted—he is owed no obedience.
For instance, if the ruler were to order the soldiers not to perform the prayer, we would reply, “No hearing and no obedience,” because prayer is an obligation that Allah has laid upon His servants—and upon you first of all. You are the very first who must pray, so there is no hearing and no obedience.
If he were to command them to do something unlawful, such as shaving their beards, we would likewise say, “No hearing and no obedience. We do not obey you; we obey the Prophet ﷺ, who said, ‘Let the beards grow and trim the mustaches.’”
Accordingly, any directive the ruler gives that constitutes disobedience to Allah deserves neither hearing nor obedience; it should be openly resisted and ignored, for whoever defies Allah and instructs His servants to do so has no right to be obeyed. Still, he must be obeyed in everything else. That is, an order to sin does not nullify all obedience to him—far from it. His claim to obedience lapses only with respect to that particular sinful order; in all other matters he must be obeyed.
Some people think that one need not obey the ruler except in what Allah has already commanded. This is incorrect, for whatever Allah has commanded is incumbent upon us regardless of whether the ruler orders it or not.
Thus the situations are threefold. First, the ruler commands something that the Sacred Law itself commands—such as ordering people to pray in congregation. In this case, compliance is required out of obedience to Allah and His Messenger as well as to the ruler.