Reading his verdict on Thursday on petitions challenging the constitutionality of the law, Chief Justice of India Dipak Misra said: "Majoritarian views and popular morality can not dictate constitutionally enshrined rights".
Gay sex is considered taboo by many in socially conservative India, and was reinstated as a criminal offense in 2013 after four years of decriminalization. However, if anyone, by which we mean both a man and a woman, engages in any kind of sexual activity with an animal, the said aspect of Section 377 is constitutional and it shall remain a penal offence under Section 377 IPC.
The Indian government had opposed ending Section 377 but said ahead of the hearing that it would leave the decision to the "wisdom" of the Supreme Court.
After the 2013 verdict, five high-profile petitioners - Bharatnatyam dancer Navtej Johar, documentary filmmaker Sunil Mehra, restaurateur Ritu Dalmia, hotelier and historian Aman Nath and business executive Ayesha Kapur - challenged it and became the human faces of this battle.
The top court said the LGBTQ community possesses same human and fundamental rights as other citizens.
Hundreds of LGBTQ campaigners, who had gathered outside the Supreme Court in New Delhi, broke into loud cheers as news of the ruling reached them. Earlier in 2009, the Delhi High Court had said that Section 377 violates the fundamental rights of the people mentioned in the Constitution.
In so far as consensual unnatural sexual act in private is concerned, it is neither harmful nor contagious to society, the bench said.
Amnesty India tweeted: "India celebrates this landmark judgement!"More news: Ex-Trump campaign aide jailed in Russian Federation probe
Another member of Pravritti said that a large number of their members have been involved in the ongoing struggle of decriminalising section 377.
Strangers handed flowers to members of the community, some waved banners while others celebrated quietly, overcome with emotion.
"We cannot change history but can pave a way for a better future", said Justice D.Y. Chandrachud.
"I am speechless! It's taken a long time to come but finally I can say I am free and I have equal rights as others", said Rama Vij, a college student in Kolkata who gathered with others watching on television.
Stating that homosexuality cannot be treated like an alternate sexual behaviour, Swamy said, "There is no finality in the Supreme Court's judgement today, and this can be overturned by a seven-judge bench". It has also asked that the police force should be given be given periodic training to sensitise them about gay rights.
In 2011, the then Union Health Minister Ghulam Nabi Azad, at a convention attended by former Congress President Sonia Gandhi and a host of other Union ministers, had said homosexuality is a "disease" and it is "unnatural".
Arvind Datar, the attorney for the petitioners, argued in the court that the penal provision was unconstitutional because it provides for the prosecution and sentencing of consenting adults.
The court has also directed the government to ensure proper broadcast of judgement.