The court has now left it to parliament to legislate on Section 377, a 153-year-old colonial law, under which a same-sex relationship is an "unnatural offence" and punishable by a 10-year jail term.
Opposition to the 2009 ruling had come from more than a dozen political, social and religious groups and petitioners.
They put up an array of arguments, many of them bizarre and, some might say, disingenuous.
One petitioner was a TV astrologer who told the court the ruling "compromises national defence since soldiers will start having sex with each other". Another opponent of change was a former MP - he argued that it was "against Indian culture".
Lining up alongside them was an organisation called the Joint Action Committee. It said the 2009 ruling would "increase male prostitution", while a Christian church group said it "harmed Christian interests" and a Muslim group argued that "sodomy is banned in Islam". Perhaps most bizarrely, a spokesman for a popular yoga guru opposed the change, telling the court that he could "cure homosexuality through yoga".
Ranged against this were some four main groups who filed petitions supporting the Delhi court decision.
They included parents of lesbian, gay, bisexual and transgender (LGBT) people with stories of how the colonial-era law had caused trauma to them and harmed their family lives; a group of more than a dozen psychiatrists and psychologists who treat LGBT "patients"; and some distinguished academics and leading Indian filmmaker Shyam Benegal.
"Now the conservatives have won. This verdict is remarkable and bizarre. How can a court take away a fundamental right which has been already given to people? It is a huge setback for the gay community. And it makes India look thoroughly stupid internationally," leading social scientist Sanjay Srivastava told me.
Most activists I spoke to believe that the judges had "little sympathy" for the gay community and had possibly had not met many homosexual people personally. They call the judgement India's Bowers v Hardwick moment, referring to a landmark 1986 US Supreme Court ruling upholding a law in Georgia that criminalised sex between consenting homosexuals. The ruling was later overturned in 2003.
It has never been easy to be openly gay in India, as I found out while doing a story on the community some years ago. Homosexuals face homophobia at work and struggle to find partners, as well as suffering from low self-esteem.
Hindu texts are ambiguous about homosexuality. Some texts, says scholar Wendy Doniger, "punish homosexual acts with very minor fines, in dramatic comparison with much more serious punishment for infringements of heterosexual customs (heavy punishment for rape, for instance). The Kama Sutra, by contrast, is "entirely non-judgemental in its description of men who have oral sex with other men".
The 2009 judgement came as a shot in the arm for India's gay community. More and more of its members had begun to come out. "The verdict is a severe blow to them," journalist and activist Vikram Doctor tells me. "Once people come out of the closet, they just cannot go back."