Castration (either chemical or by removing of the testicles) does not completely stop the possibility of further rapes.
It stops most part of the testosterone production (95 per cent) which leads to decreased libido and the ability for an erection.
But about 5 per cent of the testosterone is produced in the adrenal cortex.
And if the patient stops taking pills for chemical castration or after removing the testicles takes testosterone his libido will increase and so will the capability for an erection.
A really safe method would only be castration and penectomy. The first kills the libido, the second the use of his 'instrument'.