NEW DELHI In a landmark ruling Thursday that could usher in an era of greater freedom for gay men and lesbians in India, New Delhi’s highest court decriminalized homosexuality.

“The inclusiveness that Indian society traditionally displayed, literally in every aspect of life, is manifest in recognizing a role in society for everyone,” judges of the Delhi High Court wrote in a 105-page decision, India’s first to directly address rights for gay men and lesbians. “Those perceived by the majority as ‘deviants’ or ‘different’ are not on that score excluded or ostracized,” the decision said.

Homosexuality has been illegal in India since 1861, when British rulers codified a law prohibiting “carnal intercourse against the order of nature with any man, woman or animal.” The law, known as Section 377 of India’s penal code, has long been viewed as an archaic holdover from colonialism by its detractors.

“Clearly, we are all thrilled,” said Anjali Gopalan, the executive director and founder of the Naz Foundation, an AIDS awareness group that sued to have Section 377 changed.