A eunuch (/ˈjuːnək/ YOO-nək) is a man who has been castrated. Throughout history, castration often served a specific social function. In China, castration included removal of the penis as well as the testicles (see emasculation). Both organs were cut off with a knife at the same time.
Eunuchs existed in the Chinese court starting around 146 AD during the reign of Emperor Huan of Han, and were common as civil servants as early as the time of the Qin dynasty. From those ancient times until the Sui dynasty, castration was both a traditional punishment (one of the Five Punishments) and a means of gaining employment in the Imperial service. Certain eunuchs gained immense power that occasionally superseded that of even the Grand Secretaries, such as the Ming dynasty official Zheng He. Self-castration was a common practice, although it was not always performed completely, which led to it being made illegal.