The Messenger of Allah ﷺ said, "The one who leads the people in prayer should be the most knowledgeable of them in the Book of Allah. If they are equal in recitation, then the one who emigrated earliest. If they are equal in emigration, then the most knowledgeable of the Sunnah. If they are equal in their knowledge of the Sunnah, then the eldest among them. Do not lead a man in prayer in his own domain, and do not sit in his place of honor unless he gives you permission."
أخبرنا قتيبة قال أنبأنا فضيل بن عياض عن الأعمش عن إسمعيل بن رجاء عن أوس بن ضمعج
قال رسول الله ﷺ يؤم القوم أقرؤهم لكتاب الله فإن كانوا في القراءة سواء فأقدمهم في الهجرة فإن كانوا في الهجرة سواء فأعلمهم بالسنة فإن كانوا في السنة سواء فأقدمهم سنا ولا تؤم الرجل في سلطانه ولا تقعد على تكرمته إلا أن يأذن لك
Muslim narrated it in the Book of Mosques, chapter on "Who has more right to lead the prayer?", hadith no. 673, from the hadith of Amash with this chain, and it is also in Al-Kubra, hadith no. 855.