Second: The head of the household. If he is qualified to lead the prayer, no one may step in front of him—except with his consent.
Third: The ruler—meaning the supreme leader of the Muslims or his deputy. Provided he is competent to lead, no one may precede him in the prayer without his permission.
The evidence for giving priority to these individuals is the ḥadīth reported by Abū Dāwūd: “A man must not lead another man in his own house or within his domain of authority except with his permission.” His “domain” (sulṭān) is the area under his jurisdiction or what he personally owns.
Al-Khaṭṭābī said: “Its meaning is that the owner of the house has the strongest claim to lead the prayer in his home, so long as his recitation and knowledge enable him to establish the prayer properly. Likewise, if the imam of a mosque has been appointed by the ruler or his deputy, or the congregants have agreed to install him, then he is the one who deserves precedence, for that is a specific appointment; bypassing him would cast suspicion upon him and alienate people from him.”
From what has preceded, you can appreciate the dignity, merit, and standing of leading the prayer in Islam. The imam is a model to be followed; the office itself is an honored rank. It is an advance toward virtue, an aid to obedience, and a means of constant attachment to the congregation. Through it the mosques are filled with acts of worship, and it falls under the general purport of Allah’s words recounting the supplication