With the Supreme Court decriminalising gay sex, India joins 25 other countries where homosexuality is legal.
However, 72 countries and territories worldwide still continue to criminalise same-sex relationships, including 45 in which such relationships between women are outlawed.
In what is being hailed as a historic move, a five-judge constitution bench of the Supreme Court on Thursday unanimously decriminalised part of the 158-year-old colonial law under Section 377 of the IPC which criminalises consensual unnatural sex, saying it violated the rights to equality.
The constitution bench headed by Chief Justice Dipak Misra termed the part of Section 377 of the Indian Penal Code which criminalises consensual unnatural sex as irrational, indefensible and manifestly arbitrary.
According to a recent report of the International Lesbian, Gay, Bisexual, Trans and Intersex Association (ILGA), there are eight countries in which homosexuality can result in a death penalty, and dozens more in which homosexual acts can result in a prison sentence.
Indian equal rights activists have undertaken a long and arduous journey to decriminalise same sex relationships.
They had tasted their first victory when the Delhi High Court in July 2009 decriminalised homosexuality among consenting adults. However, in December 2012 the Supreme Court, quashing the High Court order, held that the order was legally unsustainable.
In 2015, the Lok Sabha voted against the introduction of a private member's Bill to decriminalise homosexuality, proposed by Congress MP Shashi Tharoor, indicating that the BJP led NDA Government was not in a hurry to legalise homosexuality.
Soon after a group of well known LGBT rights activists, N S Jauhar, journalist Sunil Mehra, chef Ritu Dalmia, hotelier Aman Nath and business executive Ayesha Kapur approached the SC which agreed to reconsider the issue.
The petition claimed their rights to sexuality, sexual autonomy, choice of sexual partner, life, privacy, dignity and equality, along with the other fundamental rights guaranteed under Part-III of Constitution, are violated by Section 377 .
In a ray of hope for the community, in August 2017, the apex court upheld the Right to Privacy, stating that sexual orientation is an essential attribute of privacy .
In Thursday's verdict the bench, which also comprised Justices R F Nariman, A M Khanwilkar, D Y Chandrachud and Indu Malhotra, struck down part of Section 377 of the IPC as being violative of the right to equality and the right to live with dignity.
In four separate but concurring judgements, the top court set aside its 2013 verdict in the Suresh Kaushal case which had re-criminalised consensual unnatural sex.
"I was turning into a cynical human being with very little belief in the system, but honestly this has really shown once again that, at the end, we are a functional democracy where freedom of choice, speech and rights still exist," said Dalmia who is currently in the UK.
Calling the SC verdict a historical judgment, Karan Johar wrote on Twitter, Historical judgment!!!! So proud today! Decriminalising homosexuality and abolishing #Section377 is a huge thumbs up for humanity and equal rights! The country gets its oxygen back!"
Some of the countries where gay sex has been legalised are: Argentina (2010), Greenland (2015), South Africa (2006), Australia (2017), Iceland (2010), Spain (2005), Belgium (2003), Ireland (2015), United States (2015), Brazil (2013), Luxembourg (2014), Sweden (2009) and Canada (2005).