The history and cultural relations of the hijras are rooted both in ancient Hinduism, where eunuchs are mentioned in a variety of texts, including the epic Mahabharata, and in Islam, where eunuchs served in the harems of the Mogul rulers. The ritual participation of hijras in life-cycle ceremonies has a clearly Hindu origin, though they may perform for Muslims as well. Many aspects of hijra social organization are taken from Islam, and many of the most important hijra leaders have been and are Muslim. However, hijras differ from traditional Muslim eunuchs, who did not dress as women and were sexually inactive. Nor were Muslim court eunuchs endowed with the powers to bless and to curse that hijras derive from their ambiguous sexuality and connection with the mother goddess. In the eighteenth and nineteenth centuries Hindu and Muslim hijras did not live together, but in contemporary India they often do. Another historical connection of the hijras appears to be with the Magna Mata cults in ancient Greece, whose devotees also dressed in women's clothing and sometimes castrated themselves.