The Delhi High Court today ruled that a ban on gay sex between adults violates India’s constitution.

Section 377 was enacted in 1860 under the British Raj, in line with the anti-sodomy laws in England at the time.

It punishes anyone who “voluntarily has carnal intercourse against the order of nature with any man, woman or animal” by imprisonment and criminalises a whole range of sexual acts from mutual masturbation, to fellatio and anal sex.

Chief Justice A P Shah and Justice S Muralidahr said the ban violated fundamental human rights.

The ruling said: “In the Indian Constitution, the right to live with dignity and the right of privacy both are recognised as dimensions of Article 21. Section 377 IPC denies a person’s dignity and criminalises his or her core identity solely on account of his or her sexuality and thus violates Article 21 of the Constitution. As it stands, Section 377 IPC denies a gay person a right to full personhood which is implicit in notion of life under Article 21 of the Constitution.”

The decision was made in response to a case filed by Naz Foundation India. The ruling can still be opposed by the government.

The health ministry has called for the ban to be scrapped, saying it hampered efforts to fight the spread of HIV/AIDS in the country. However, the home ministry opposed the move, saying that gay sex is the product of “a perverse mind”.

Human Rights Watch has welcomed the decision. LGBT director Scott Long said: “This legal remnant of British colonialism has been used to deprive people of their basic rights for too long. This long-awaited decision testifies to the reach of democracy and rights in India.”