A member of the lesbian, gay, bisexual, transgender (LGBT) community celebrates the Supreme Court decision to strike down a colonial-era ban on gay sex, in Mumbai on September 6, 2018. - India's Supreme Court on September 6 struck down the ban that has been at the centre of years of legal battles. "The law had become a weapon for harassment for the LGBT community," Chief Justice Dipak Misra said as he announced the landmark verdict. (Photo by INDRANIL MUKHERJEE / AFP)        (Photo credit should read INDRANIL MUKHERJEE/AFP/Getty Images)
INDRANIL MUKHERJEE/AFP/Getty Images
A member of the lesbian, gay, bisexual, transgender (LGBT) community celebrates the Supreme Court decision to strike down a colonial-era ban on gay sex, in Mumbai on September 6, 2018. - India's Supreme Court on September 6 struck down the ban that has been at the centre of years of legal battles. "The law had become a weapon for harassment for the LGBT community," Chief Justice Dipak Misra said as he announced the landmark verdict. (Photo by INDRANIL MUKHERJEE / AFP) (Photo credit should read INDRANIL MUKHERJEE/AFP/Getty Images)
Now playing
01:46
India's top court decriminalizes gay sex
People participate in the San Francisco Pride parade in San Francisco, California on June 25, 2017. / AFP PHOTO / Josh Edelson        (Photo credit should read JOSH EDELSON/AFP/Getty Images)
JOSH EDELSON/AFP/AFP/Getty Images
People participate in the San Francisco Pride parade in San Francisco, California on June 25, 2017. / AFP PHOTO / Josh Edelson (Photo credit should read JOSH EDELSON/AFP/Getty Images)
Now playing
01:02
Cities celebrate Gay Pride Month
ESPN
Now playing
00:54
ESPN Body Issue features same-sex couple
Instagram/JVN
Now playing
01:04
'Queer Eye' star's emotional Emmy reaction
A "Vote Yes" banner in support of same sex-marriage hangs on a street in Sydney on September 5, 2017. 
Same-sex marriage advocates launched legal action in Australia's highest court on September 5, 2017 against a controversial government plan for a postal vote on the issue, calling it divisive and harmful. / AFP PHOTO / PETER PARKS        (Photo credit should read PETER PARKS/AFP/Getty Images)
PETER PARKS/AFP/Getty Images
A "Vote Yes" banner in support of same sex-marriage hangs on a street in Sydney on September 5, 2017. Same-sex marriage advocates launched legal action in Australia's highest court on September 5, 2017 against a controversial government plan for a postal vote on the issue, calling it divisive and harmful. / AFP PHOTO / PETER PARKS (Photo credit should read PETER PARKS/AFP/Getty Images)
Now playing
03:15
Australia to vote on same-sex marriage
Now playing
01:34
Gay pride parade obstructed by Turkish police
Now playing
05:51
Ian McKellen on coming out and being knighted
north carolina roy cooper bathroom bill repeal sot_00003518.jpg
WNCN
north carolina roy cooper bathroom bill repeal sot_00003518.jpg
Now playing
01:15
North Carolina repeals bathroom law
Attendees of the Equality March pass by the White House
Paul P. Murphy / CNN
Attendees of the Equality March pass by the White House
Now playing
02:35
Equality marchers push for progress on LGBT rights
Same-sex activists hug outside the parliament in Taipei on May 24, 2017 as they celebrate the landmark decision paving the way for the island to become the first place in Asia to legalise gay marriage.
Crowds of pro-gay marriage supporters in Taiwan on May 24 cheered, hugged and wept as a top court ruled in favour of same-sex unions. / AFP PHOTO / SAM YEH        (Photo credit should read SAM YEH/AFP/Getty Images)
SAM YEH/AFP/AFP/Getty Images
Same-sex activists hug outside the parliament in Taipei on May 24, 2017 as they celebrate the landmark decision paving the way for the island to become the first place in Asia to legalise gay marriage. Crowds of pro-gay marriage supporters in Taiwan on May 24 cheered, hugged and wept as a top court ruled in favour of same-sex unions. / AFP PHOTO / SAM YEH (Photo credit should read SAM YEH/AFP/Getty Images)
Now playing
00:54
Taiwan moves closer to legalizing gay marriage
Now playing
02:50
Gay men tell of brutality in Chechnya
North Carolina gender bathrooms bill pkg_00002112.jpg
WRAL
North Carolina gender bathrooms bill pkg_00002112.jpg
Now playing
01:29
What is HB2?
public bathroom controversy history nws orig_00002429.jpg
public bathroom controversy history nws orig_00002429.jpg
Now playing
01:32
It's not the first time toilets have divided America
CBS / "60 Minutes"
Now playing
01:24
Trump on SCOTUS: I'm fine with same-sex marriage
transgender student bathroom support rally dnt_00011714.jpg
transgender student bathroom support rally dnt_00011714.jpg
Now playing
01:38
Crowd rallies in support of transgender student
battle over religious freedom laws nick valencia lead dnt_00001926.jpg
AP
battle over religious freedom laws nick valencia lead dnt_00001926.jpg
Now playing
03:22
Tenn. bill would allow therapists to deny LGBT patients
china gay marriage rivers lklv _00002407.jpg
Sun Wenlin
china gay marriage rivers lklv _00002407.jpg
Now playing
01:22
Chinese court dismisses same-sex marriage lawsuit
(CNN) —  

India’s Supreme Court has struck down a colonial-era law criminalizing consensual gay sex, overturning more than 150 years of anti-LGBT legislation.

The court announced the landmark verdict in Delhi on Thursday, as jubilant crowds cheered and rights activists hugged one another, overcome with emotion.

Section 377, an archaic law imposed during British rule that penalized intercourse “against the order of nature,” had carried a maximum sentence of life imprisonment.

The decision to repeal the law is a major victory for India’s LGBT activists and supporters after years of determined struggle.

Crowds in Mumbai cheer the Supreme Court announcement.
DIVYAKANT SOLANKI/EPA-EFE
Crowds in Mumbai cheer the Supreme Court announcement.

“I can’t even explain how I am feeling right now. The long battle has been won. Finally we have been recognized by this country,” said Bismaya Kumar Raula, wiping away tears outside the court.

Others gathered said that, while they had anticipated a positive outcome, the result still came as a shock.

“It’s an emotional day for me. It’s a mix of feelings, it’s been a long fight,” said rights campaigner Rituparna Borah. “There was not enough media or society support earlier but we have it now. People will not be seen as criminals anymore.”

Though the law was rarely enforced in full, lawyers argued that it helped perpetuate a culture of fear and repression within the LGBT community.

A change in legislation will “create a space of freedom where you can start expecting justice,” Danish Sheikh, a law professor at Jindal Global Law School and LGBT advocate, told CNN.

Indian LGBT activists in Mumbai react to the news that the Supreme Court has struck down Section 377.
DIVYAKANT SOLANKI/EPA-EFE
Indian LGBT activists in Mumbai react to the news that the Supreme Court has struck down Section 377.

Long battle

Thursday’s historic ruling is the culmination of a lengthy and often fraught legal battle for equality in a country where homosexuality remains taboo.

In 2009, the Delhi High Court ruled that the ban on consensual gay sex violated fundamental rights. The decision, which only applied to the Delhi region, was quickly overruled by the Supreme Court in 2013, following a petition launched by a loose coalition of Christian, Hindu and Muslim groups.

In its 2013 ruling, the Supreme Court said that only a “minuscule fraction of the country’s population constitute lesbians, gays, bisexuals or transgenders” and it was therefore “legally unsustainable” to repeal the act.

During the latest hearings, lawyers representing more than a dozen gay and lesbian Indians questioned the constitutional basis of that earlier ruling.

“It was a wrong judgment. It was not legal and it was based wrongly on the tenets of the constitution,” said Colin Gonsalves, one of the lawyers representing the current group of petitioners.

That case was strengthened last year, when the Supreme Court moved to uphold the constitutional right to privacy.

The ruling, which declared sexual orientation to be an “essential attribute of privacy,” helped galvanize campaigners.

“Last year’s ruling eviscerated the 2013 judgment,” said Gonsalves. “There is no issue now. There is not much left to argue,” he added.

Opposition to moves to overturn Section 377 had rested predominately on religious and moral objections. In an interview earlier this year, lawmaker Subramanian Swamy, a prominent member of the ruling Bharatiya Janata Party (BJP), described the legalization of gay sex as a “danger to national security” and “against Hindutva.”

Hinduism has traditionally maintained a flexible, non-prescriptive view of sexuality. However, in recent years hardline Hindu groups have taken a more conservative approach.

In the run up to the judgment, the BJP refrained from taking a public stand, deferring instead to the court.

Dehumanizing colonial law

Out of the estimated 48 former British colonies that criminalize homosexuality, 30 still have laws based on the original colonial anti-LGBT legislation, according to Lucas Mendos, co-author of the 2017 International LGBTI Association “State-Sponsored Homophobia” report.

In the case of India, the original British law had remained in place more or less unchanged since it was introduced by British colonizers in the 1860s.

According to India’s National Record Bureau, more than 2,100 cases were registered under the law in 2016. India did not maintain a separate database of prosecution under section 377 until 2014.

Arif Jafar, one of the current group of petitioners whose case the Supreme Court ruled on, was arrested in 2001 under Section 377 and spent 49 days in jail.

Supporters in Mumbai react to the Supreme Court ruling that gay sex is no longer a criminal offense.
DIVYAKANT SOLANKI/EPA-EFE
Supporters in Mumbai react to the Supreme Court ruling that gay sex is no longer a criminal offense.

Jafar now runs an informal support group in the northern state of Uttar Pradesh. The group, named “Trust,” provides counseling, support and sexual health services to gay and transgender persons.

In his petition, Jafar described the experience as dehumanizing and a violation of his fundamental rights. He also alleged that he was beaten and humiliated every day because of his sexuality.

Campaigners in India pointed out that the law didn’t only trap members of the LGBT community in the closet, it also invited other forms of discrimination, providing a cover for blackmail and harassment.

Members of India's LGBT community dance in celebration after the ruling was announced in Bangalore on Thursday.
Aijaz Rahi/AP
Members of India's LGBT community dance in celebration after the ruling was announced in Bangalore on Thursday.

“The constant fear of 377 we have felt will not be there for the coming generation,” said Yashwinder Singh, of Mumbai-based LGBT rights group The Humsafar Trust.

“Laws getting passed is one thing but changing the society is a big challenge,” said Singh of the court’s decision, Thursday.

“Our work has started multifold now. We have to go and talk to people and change their mindset so that they accept every human as one.”

Following the announcement Thursday, the Congress Party, the country’s main opposition, posted a message of congratulations on social media, welcoming the “progressive and decisive verdict” from the Supreme Court.

As supporters celebrate the decision, activists will now be shifting focus to the broader issue of equality.

People celebrate the decision in Bangalore on September 6.
MANJUNATH KIRAN/AFP/Getty Images
People celebrate the decision in Bangalore on September 6.

“The next step is to start looking at issues of rights. Right now, it is just decriminalizing,” Anjali Gopalan, founder of the Naz Foundation, which has spearheaded the fight against Section 377, told CNN.

“The right that every citizen of the country should have access to and should not be taken for granted. Like the right to marry, the right to adopt, the right to inherit. Things that no one questions and that are clearly denied to a certain section of citizens.”

CNN’s Ben Westcott and Swati Gupta contributed to this report.