New Delhi 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.

“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.

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