India’s top court has ruled that discrimination on the basis of sexual orientation is a fundamental violation of rights. This means that gay sex is no longer a criminal offence in the country.

The ruling at India’s Supreme Court today overturns a 2013 judgement that upheld a colonial-era law, known as section 377, under which gay sex is categorised as an “unnatural offence”.

Under section 377 certain sexual acts, including anal and oral sex, could be punishable by a 10-year jail term.

However, there remains strong opposition for the ruling among religious groups and in conservative rural communities.

Delivered by a five-judge bench headed by India’s outgoing chief justice Dipak Misra, the decision was unanimous.

The ruling now stands as the “final say in the matter” and cannot be challenged. As such, it represents a huge victory for India’s LGBT community.

Reading out the judgement, chief justice Dipak Misra said: “Criminalising carnal intercourse is irrational, arbitrary and manifestly unconstitutional.”

Another judge, Indu Malhotra, said she believed “history owes an apology” to LGBT people for ostracising them.

Justice DY Chandrachud said the state had no right to control the private lives of LGBT community members and that the denial of the right to sexual orientation was the same as denying the right to privacy.

Critics say in a largely conservative India, it will be some time before attitudes change and communities finds full acceptance.