We set out as a delegation until we reached the Messenger of Allah ﷺ. We pledged our allegiance to him and prayed with him. When he finished the prayer, a man who appeared to be a bedouin came and asked, "Messenger of Allah, what do you say about a man who touches his penis during the prayer?"He replied, "Is it anything but a piece of flesh from you, or a part of you?"
أخبرنا هناد عن ملازم قال حدثنا عبد الله بن بدر
خرجنا وفدا حتى قدمنا على رسول الله ﷺ فبايعناه وصلينا معه فلما قضى الصلاة جاء رجل كأنه بدوي فقال يا رسول الله ما ترى في رجل مس ذكره في الصلاة قال وهل هو إلا مضغة منك أو بضعة منك
[Its chain of transmission is sahih] Reported by Tirmidhi, in the book of Purification, chapter on not performing wudu after touching the penis, hadith no. 85, from Hannad, and by Abu Dawud, in the book of Purification, chapter on the permission granted regarding that, hadith no. 182, through the hadith of Mulazim bin Amr, with the same wording. It is also found in Sunan al-Kubra, hadith no. 160. Fallas, Ibn Hibban, Tabarani, and others graded it sahih.This hadith is abrogated, as Imam Ibn Hibban established, because Talq bin Ali's arrival before the Prophet ﷺ took place in the first year of the Hijra. See Al-Ihsan bi Tartib Sahih Ibn Hibban, 2/224, hadith no. 1119.