India's government has told the Supreme Court that homosexuality is immoral, "against nature and spreads HIV".
The home ministry urged the court to reverse a 2009 landmark decision by the Delhi High Court which decriminalised gay sex.
The ruling overturned a 148-year-old colonial law which described a same-sex relationship as an "unnatural offence".
The Supreme Court had earlier asked groups challenging the judgement to define "unnatural sex".
Many people in India still regard same-sex relationships as illegitimate, but rights groups have long argued that the law contravened human rights.
Section 377 of the colonial Indian Penal Code defined homosexual acts as "carnal intercourse against the order of nature" and made them illegal.
In July 2009 the Delhi High Court described the colonial-era law as discriminatory and said gay sex between consenting adults should not be treated as a crime.
Until the high court ruling, homosexual acts were punishable by a 10-year prison term.
The ruling was widely and visibly welcomed by India's gay community, which said the judgement would help protect them from harassment and persecution.
But it was challenged by political, social and religious groups who wanted to have the colonial-era law reinstated.
Last week, the Supreme Court begun a debate on the legality of decriminalising gay sex in private between consenting adults.
"So who is the expert to say what is 'unnatural sex'? The meaning of the word has never been constant," Justices GS Singhvi and SJ Mukhopadhyaya asked a petitioner who challenged the judgement.
"We have travelled a distance of 60 years. Now it is test-tube babies, surrogate mothers. They are called discoveries. Is it in the order of nature? Is there carnal intercourse?" the judges said.
- BBC News