Castration describes any medical procedure which results in the end of function of the testicles. In modern use, reversible chemical castration using pharmaceuticals such as depo-provera are the method of choice. However, in the past, physical amputation was fairly common.
Historically, castration was used to create eunuchs - a class of civil servant known in both Chinese and Middle Eastern cultures who were given trustworthy positions within the households of the aristocracy. It was also used well into the modern era to create castrati, males who were castrated before their voices deepened so they could sing in higher registers well into adulthood.
In modern times, chemical castration is a common therapy to attempt to prevent recidivism by habitual sex offenders.