عن العلاء بن زياد عن أبيه أنهم كانوا يفعلونه في المغازي يعني الاستمناء يعبث الرجل بذكره يدلكه حتى ينزل قال قتادة وقال الحسن في الرجل يستمنى يعبث بذكره حتى ينزل قال كانوا يفعلون في المغازي وعن جابر بن زيد ابي الشعثاء قال هو ماؤك فأهرقه يعني الاستمناء وعن مجاهد قال كان من مضى يأمرون شبابهم بال استمناء يستعفون بذلك
المحلى لإبن حزم كتاب كتاب مسائل التعزير
'Alaa ibn Ziyad related from his father that they used to do it during military raids, that is, masturbate, when a man plays with his penis and rubs it until he discharges. Qatada said, and Al-Hasan said, regarding someone who masturbates – plays with his penis until he discharges – he said: They used to do it during military raids. Jabir ibn Zaid Abi Al-Sha'thaa said: "It's your fluid, so spill it out", meaning masturbation. And from Mujahid, who said: In the past some people used to tell their young men to masturbate, to keep themselves restrained.
Ibn Hazm, Al-muhalla, The book of matters of discretionary punishment [ta'zir]