It is narrated from Abdullah bin Arqam (may Allah be pleased with him) that he set out towards Makkah and some people from his tribe accompanied him. He used to lead them in prayer. (Once) the prayer was established and he took hold of a man and put him forward, and said: The Messenger of Allah (ﷺ) said: "When the congregation is established and any of you feels the need to relieve himself, he should first relieve himself."
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 326
Hadith Takhrijأخرجه الترمذي: الطهارة، باب ما جاء إذا أقيمت الصلاة ووجد أحدكم الخلاء فليبدأ بالخلاء: 142 - وقال حسن صحيح۔ وأبو داود : الطهارة، باب أيصلي الرجل وهو حاقن: 88 ۔ والنسائي: الإمامة، باب العذر في ترك الجماعة : 853 ۔ وصححه ابن خزيمة : 932، 1652 ۔ والحاكم : 1/ 168، 257۔