The practice of slavery in Vietnam persisted since the Hồng Bàng period. Vietnam has been both a source and a destination for slaves.
Hồng Bàng period
During the Hồng Bàng period, the society was divided into three classes consisting of kings, citizens and slaves. A slave, the lowest class, served the aristocracy.
Chinese rule
During the Chinese domination period, Vietnamese girls were sold as sex slaves to the Chinese. A large trade developed where the native girls of Nam Viet were enslaved and brought north to the Chinese. Southern Yue girls were sexually eroticized in Chinese literature and in poems written by Chinese who were exiled to the south.
Dynastic era
The Vietnamese enslaved enemy prisoners of war including the Chinese and Cham.
Lý dynasty
During the Lý dynasty, Vietnam raided Song dynasty to enslave Chinese, who were forced to serve in the Vietnamese army as soldiers. Vietnamese Buddhist Temples received Cham slaves who were prisoners of war.
Lê dynasty
After the Cham–Vietnamese War (1471) Cham prisoners were given as slaves to Vietnamese estates. They were all eventually ordered to be killed due to a royal order.
Emperor Lê Thánh Tông was aggressive in his relations with foreign countries including China and Malacca and cracked down on foreign trade and contacts, enforcing an isolationist policy. 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 illegal foreign trade by Vietnam. 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 sterilized with pepper water and then cut off. A tube would be then inserted into the urethra to allow urination during healing. Any facial hair such as the beard would fall off and the eunuch's voice would become like a girl's. The eunuchs served as slaves to the Vietnamese palace women in the harem like the consorts, concubines, maids, Queen, and Princesses, doing most of the work. The only man allowed in the Palace was the Emperor, the only others allowed were his women and the eunuchs since they were not able to have sexual relations with the women. The eunuchs were assigned to do work for the palace women like massaging and applying make up to the women and preparing them for sex with the Emperor.
Several Malay envoys from the Malacca Sultanate were attacked and captured in 1469 by 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.