I agree with the previous comment that the testes do not develop properly. Male hormones are also produced in the testes and if the testes cannot perform their function the sexual hormones do not get made and impotence of the situation = eunich.
Other times it is the removal or destruction of the testes by some accident or so. But again anything that causes the testes to sop hormone production stops sexual stimulation etc
I have also heard eunich used to describe a person that takes on some type of positition that invovles the ceasing of sexual activity - priest or something.
I reckon any one that has committed sexual offenses against children should be required to do what ever needs to be done (cease testes from working) to prevent them ever misusing the sexual preferences ever again.