"Section 377" bans "carnal intercourse against the order of nature with any man, woman or animal" - which is widely interpreted to refer to homosexual sex.

Gay sex is punishable by up to 10 years in jail under the 1861 law. Although prosecution under Section 377 is not common, gay activists say the police use the law to harass and intimidate members of their community.

The ban on gay sex has been challenged by five high-profile petitioners who say they are living in fear of being punished.

The petitioners are, Bharatnatyam dancer Navtej Singh Johar, journalist Sunil Mehra, restaurateur Ritu Dalmia, Neemrana hotel chain co-founder Aman Nath and businesswoman Ayesha Kapur.

The petitioners argue that Section 377 violates rights principles enshrined in the constitution, like equality before law, no discrimination based on religion, race, caste, sex or place of birth and freedom of speech and expression.

"(Homosexuality) is not an aberration, but a variation," Justice Indu Malhotra said in a hearing on July 12. "Because of family pressures and societal pressures, they are forced to marry the opposite sex and it leads to bi-sexuality and other mental trauma."

The government is likely to go by the court and not push for criminalizing gay sex.

The Supreme Court had in 2013 cancelled a Delhi high court order that had decriminalized homosexuality by overturning the outdated law and said it was the job of parliament to decide on scrapping laws.

The Supreme Court this year said the court "cannot wait for a majoritarian government" to decide on enacting, amending or striking down a law if it violates fundamental rights.