 When they founded the Liao dynasty they developed a harem system with concubines and wives and adopted eunuchs as part of it.The Khitans captured Chinese eunuchs at the Jin court when they invaded the Later Jin.Another source was during their war with the Song dynasty, the Khitan would raid China, capture Han Chinese boys as prisoners of war and emasculate them to become eunuchs.