It is narrated from Sayyiduna Abdullah bin al-Arqam (may Allah be pleased with him) that he (peace and blessings be upon him) said: "When the time of prayer comes and a man intends to go to the toilet, let him begin with the toilet."
(b) Sayyiduna Abdullah bin al-Arqam (may Allah be pleased with him) used to lead his companions in prayer. He went away for a need, then returned and said: I heard the Messenger of Allah (peace and blessings be upon him) say: "When one of you needs to relieve himself, let him do so before the prayer."
(c) In the narration of al-Alawi it is that the Prophet (peace and blessings be upon him) said: "When the time of prayer comes and a man intends to go to the toilet, let him begin with the toilet."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5028