and to stop him from raping her. during the qing dynasty (1644–1911 ad), the sons and grandsons of the rebel yaqub beg in china were all sentenced to castration. surviving members of yaqub beg's family included his four sons, four grandchildren (two grandsons and two granddaughters), and four wives. they either died in prison in lanzhou, gansu, or were killed by the chinese. his sons yima kuli, k'ati kuli, maiti kuli, and grandson aisan ahung were the only survivors in 1879. they were all underage children, and put on trial, sentenced to an agonizing death if they were complicit in their father's rebellious "sedition", or if they were innocent of their fathers crimes, were to be sentenced to castration and serving as eunuch slaves to chinese troops, when they reached 11 years old, and handed over to the imperial household to be executed or castrated. although some sources assert that the sentence of castration was carried out, official sources from the us state department and activists involved in the incident state that yaqub beg's son and grandsons had their sentence commuted to life imprisonment with a fund provided for their support. korea the eunuchs of korea, called naesi (내시, 內侍), were officials to the king and other royalty in traditional korean society. the first recorded appearance of a korean eunuch was in goryeosa ("history of goryeo"), a compilation about the goryeo period. in 1392, with the founding of the joseon dynasty, the naesi system was revised, and the department was renamed the "department of naesi" (내시부, 內侍府). the naesi system included two ranks, those of sangseon (상선, 尙膳, "chief of naesi"), who held the official title of senior second rank, and naegwan (내관, 內官, "common official naesi"), both of which held rank as officers. 140 naesi in total served the palace in joseon dynasty period. they also took the exam on confucianism every month. the naesi system was repealed in 1894 following gabo reform. according to legend, castration consisted of daubing a boy's genitals with human feces and having a dog bite them off. during the yuan dynasty, eunuchs became a desirable commodity for tributes, and dog bites were replaced by more sophisticated surgical techniques. vietnam the vietnamese adopted the eunuch system and castration techniques from china. records show that the vietnamese performed castration in a painful procedure by removing the entire genitalia with both penis and testicles being cut off with a sharp knife or metal blade. the procedure was agonizing since the entire penis was cut off. the young man's thighs and abdomen would be tied, and others would pin him down on a table. the genitals would be washed with pepper water and then cut off. a tube would be then inserted into the urethra to allow urination during healing. many vietnamese eunuchs were products of self-castration in order to gain access to the palaces and power. in other cases, they might be paid to become eunuchs. they served in many capacities, from supervising public works, to investigating crimes, to reading public proclamations. lý thường kiệt was a prominent eunuch general during the lý dynasty (1009–1225). the trần dynasty sent vietnamese boy eunuchs as tribute to ming dynasty china several times, in 1383, 1384 and 1385 nguyen dao, nguyen toan, tru ca, and ngo tin were among several vietnamese eunuchs sent to china. during the fourth chinese domination of vietnam, the ming chinese under the yongle emperor castrated many young vietnamese boys, choosing them for their handsomeness and ability, and brought them to nanjing to serve as eunuchs. among them were the architect-engineer nguyễn an and nguyen lang (阮浪). vietnamese were among the many eunuchs of different origins found at yongle's court. among the eunuchs in charge of the capital battalions of beijing was xing an, a vietnamese. in the lê dynasty the vietnamese emperor lê thánh tông was aggressive in his relations with foreign countries including china. a large amount of trade between guangdong and vietnam happened during his reign. early accounts recorded that the vietnamese captured chinese whose ships had blown off course and detained them. young chinese men were selected by the vietnamese for castration to become eunuch slaves to the vietnamese. it has been speculated by modern historians that the chinese who were captured and castrated by the vietnamese were involved in trade between china and vietnam instead of actually being blown off course by the wind and they were punished as part of a crackdown on foreign trade by vietnam. several malay envoys from the malacca sultanate were attacked and captured in 1469 by the lê dynasty of annam (vietnam) as they were returning to malacca from china. the vietnamese enslaved and castrated the young from among the captured. a 1472 entry in the ming shilu reported that when some chinese from nanhai county escaped back to china after their ship had been blown off course into vietnam, where they had been forced to serve as soldiers in vietnam's military. the escapees also reported that they found out up to 100 chinese men remained captives in vietnam after they were caught and castrated by the vietnamese after their ships were blown off course into vietnam. the chinese ministry of revenue responded by ordering chinese civilians and soldiers to stop going abroad to foreign countries. china's relations with vietnam during this period were marked by the punishment of prisoners by castration. a 1499 entry in the ming shilu recorded that 13 chinese men from wenchang including a young man named wu rui were captured by the vietnamese after their ship was blown off course while traveling from hainan to guangdong's qin subprefecture (qinzhou), after which they ended up near the coast of vietnam, during the chenghua emperor's rule (1447–1487). twelve of them were enslaved to work as agricultural laborers, while the youngest, wu rui (吳瑞) was selected for castration since he was the only young man and he became a eunuch attendant at the vietnamese imperial palace in thang long. after years of service, he was promoted at the death of the vietnamese ruler in 1497 to a military position in northern vietnam. a soldier told him of an escape route back to china and wu rui escaped to longzhou. the local chief planned to sell him back to the vietnamese, but wu was rescued by the pingxiang magistrate and then was sent to beijing to work as a eunuch in the palace. the đại việt sử ký toàn thư records that in 1467 in an bang province of dai viet (now quảng ninh province) a chinese ship blew off course onto the shore. the chinese were detained and not allowed to return to china as ordered by le thanh tong. this incident may be the same one where wu rui was captured. in the nguyễn dynasty the poet hồ xuân hương mocked eunuchs in her poem as a stand-in for criticizing the government. commoners were banned from undergoing castration in vietnam; only adult men of high social rank could be castrated. most eunuchs were born as such with a congenital abnormality. the vietnamese government mandated that boys born with defective genitalia were to be reported to officials, in exchange for the town being freed from mandatory labor requirements. the boy would have the option of serving as a eunuch official or serving the palace women when he became ten years old. this law was put in place in 1838 during the nguyễn dynasty. the only males allowed inside the forbidden city at huế were the emperor and his eunuchs. the presence of eunuchs in vietnam was used by the french colonizers to degrade the vietnamese. americas in 1778, thomas jefferson wrote a bill in virginia reducing the punishment for rape, polygamy or sodomy from death to castration. over the years, several u.s. states have passed laws regarding chemical castration for sex offenders but not one state has mandatory castration. in 2016, alabama lawmaker steve hurst proposed a bill requiring certain sex offenses to require the perpetrator be castrated prior to their release from state custody. a 1969 study found that men institutionalized at the same facility in kansas lived an extra 14 years, on average, if they were castrated. in 1983, judge c. victor pyle sentenced three men convicted of rape to choose between 30 years in prison or castration. the south carolina supreme court ruled that the castration option would be cruel, however, and the men were sentenced to prison. iran aqa mohammad khan qajar, who established the qajar dynasty in iran (in the 18th century), was a victim of castration by officers of the previous kingdom. when he conquered lotf ali khan, the last king of the zand dynasty, aqa mohammad khan qajar had lotf ali khan castrated in revenge. modern trafficking an article in the gulf times revealed in 2005 a major sex trade in mostly nepalese boys who were lured to india and sold to brothels in mumbai, hyderabad, new delhi, lucknow and gorakhpur. one victim was lured from nepal at the age of 14, sold into slavery, locked up, beaten, starved, and forcibly castrated. he reported that he was held in a brothel with 40 to 50 other boys, many of whom were also castrated. he escaped and made his way back to nepal. two non-governmental organizations, one that works with homosexuals in nepal, and one that works to rescue and rehabilitate trafficked women and children, were co-operating to help and rescue these boys. prevention of crime voluntary or mandated preventative chemical or surgical castration has been in practice in many countries—reports are available from american and european countries in particular for over eighty years (chemical for circa thirty)—as an option for treatment for people who have broken laws of a sexual nature, allowing them to return to the community from otherwise lengthy detentions. the effectiveness and ethics of this treatment are heavily debated. a temporary "chemical castration" has been studied and developed as a preventive measure and punishment for several repeated sex crimes, such as rape or other sexually related violence. this has also been used to treat homosexuality, such as the chemical castration ordered against alan turing. in modern times, the czech republic practices surgical castration of convicted sex offenders. according to the reports compiled by council of europe, a human-rights forum, the central european country physically castrated at least 94 prisoners in the 10 years up to april 2008. the czech republic defends this procedure as voluntary and effective. according to dr. martin hollý, director of the psychiatric hospital bohnice in prague, none of the nearly 100 sex offenders who had been physically castrated had committed further offences. one serial offender stated that being castrated was the "best decision" he ever made: "on the one hand you have to protect the potential victims and on the other hand i wanted to be protected from myself, i wanted to live like a normal person." don grubin, a professor at newcastle university's institute of neuroscience who also runs a chemical castration program backed by the uk's ministry of justice, was initially opposed to physical castration. after visiting the czech republic, however, he agreed that some form of castration might be of benefit to some sex offenders. in 2020, the pakistani-controlled section of kashmir passed a bill allowing for convicted child sex abusers to be chemically or surgically castrated. in 2020, a motion calling for surgical castration of convicted rapists was defeated in the nigerian house of representatives. however, there remains support for the policy. criticism some criminologists argue that the apparently lower recidivism rates in castrated male sex offenders compared to non-castrated ones does not prove that it is a biological effect of castration, but can be explained by other factors. one suggested factor from game theory is that men who are willing to accept castration to get a shorter prison sentence are those who value freedom from prison higher than men who are not willing to pay the price for freedom in the form of their testicles. this hypothesis can explain their apparent lower recidivism as a result of working harder to conceal the evidence for their crimes, and argue that their parole is a danger of releasing offenders who only hide their crimes more efficiently and are not any less likely to