It is narrated from Sayyiduna Abdullah bin Arqam al-Zuhri (may Allah be pleased with him) that he set out for Makkah while he was their imam. He put a man forward to lead them in prayer, then said: "I heard the Messenger of Allah (peace and blessings be upon him) say: 'When the prayer has begun and one of you needs to relieve himself, let him first attend to it.'"
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14058