In China, to become a servant of the emperor, men had to be castrated. This would prevent them from having sons or having affairs with royal concubines. Eunuchs in China have been known to usurp power in many eras of Chinese history, most notably in the Later Han, late Tang and late Ming Dynasties. There are similar recorded Middle Eastern events.