There was a person who suffered from lust unceasingly, who desired to self-eradicate his genitals. The Buddha spoke to him, “If severing those genitals, it is not as good as to sever that lustful mind. The mind is like a police chief, with the police chief if ceased, those following will all cease. With the evil mind not ceased, with severing of genitals, what benefit [is there?” The Buddha for him spoke this] verse, “Desires are born from your intentions, and intentions are with thinking born. With both minds, each still and quiet, there will be no form and also no activity.” The Buddha said, “This verse was by Kāśyapa Buddha spoken.”
— Śākyamuni Buddha
(Sūtra Of 42 Sections: 31st Section)
Please Be Mindful Of Your Speech, Namo Amituofo!