LGBT history in India
LGBTQ people are well documented in various artworks and literary works of Ancient India, with evidence that homosexuality and transsexuality were accepted by the major dharmic religions. Hinduism and the various religions derived from it were not homophobic and evidence suggests that homosexuality thrived in ancient India until the medieval period. Hinduism describes a third gender that is equal to other genders and documentation of the third gender are found in ancient Hindu and Buddhist medical texts. The term "third gender" is sometimes viewed as a specifically South Asian term, and this third gender is also found throughout South Asia and East Asia.
It's likely that parts of north western fringes of Indian empires were influenced by homophobia early on through Zostorarianism (250 BCE) and Islam, both of which explicitly forbade homosexual sex, and that this influenced socio-cultural noms in that region. LGBTQ people in the Islamic communities were persecuted more severely especially under the rule of the Mughals, which ruled over large parts of India and Central Asia (and ultimately derives from the Mongol Empire), though Mughal leaders largely tolerated the cultures of the various non-Muslim communities of India.
From the early modern period, colonialism from Europe also brought with it more centralized legal codes that imposed Christian-European morals that were homophobic in nature, including criminalizing sex between two people of the same gender, and criminalizing transsexuality.
In the 21st century following independence, there has been a significant amount of progress made on liberalizing LGBTQ laws and reversing the homophobia and transphobia of the previous colonial era.