Eunuch castrated males. As workers and officials, eunuchs were kept in royal harems during ancient and medieval times. The system of castrating men for special purpose existed in China as early as 8th century BC. Throughout ancient and medieval times eunuchs are seen to have played important roles in China as servants in royal harems, and as guards and advisors to Queen Dowagers, warriors and ministers.
It appears that the institution of eunuch was introduced in India during the early Sultani period. Though eunuchs were engaged mainly for guarding harems of the royal palaces of the Sultans, like their Chinese counterparts, Sultani eunuchs played significant political and military roles as well. For example, Malik Kafur, a great general and Wazir of Sultan Alauddin Khalji (1296-1316 AD), was a eunuch. Like their Delhi counterparts, the eunuchs of Bengal aristocracies played important roles in administration. During the Habsi regime (1442-1498 AD) in Bengal, they acquired so much influence that they even played the role of king-makers. One of them, Shahzada alias Barbak, occupied the throne of Bengal in 1487 AD. Another Habshi Sultan, Shamsuddin Muzaffar Shah (1491-1493 AD), is believed by scholars to be a eunuch.
According to duarte barbosa, a Portuguese visitor to Bengal, harems of the ruling aristocracies in Bengal were guarded by eunuchs of local and foreign origins. The harem of Nawab Shujauddin Khan (1727-1739) is said to have been guarded by eunuchs imported from northwest India.
Historical and anthropological researches suggest that the institution of eunuch was most possibly the effect of the rise of polygamy, concubinage, and harems. To guard women in the harem, castrated males were employed. Normally, young soldiers captured in wars were selected for castration. Often slave merchants bought healthy and attractive boys from the market and sold them to royal and aristocratic harems after castration and rudimentary training. There is not enough evidence to establish the existence of the institution of eunuchs in Bengal before Turko-Mughal regimes. Sanskrit texts testify to the fact that the ancient rulers of Bengal and of India used to maintain neutered persons to guard their harems. [Sirajul Islam]