India’s Supreme Court overturned a historic lower-court decision on homosexuality Wednesday, making gay sex a crime in the world’s most populous democracy, with violators facing up to 10 years in prison.

The court ruled that a British colonial-era statute outlawing “carnal intercourse against the order of nature” was constitutional. Changing it should be left to Parliament, not the courts, the judges ruled.

The ruling was a striking sign of how the gay rights movement has been met with a fierce backlash in some parts of the world, even as it has made dramatic gains in the United States, Europe and Latin America.

The Delhi High Court had legalized consensual same-sex relations in 2009. That victory was seen as a watershed moment in the country’s gay rights movement, which has been growing despite strong opposition from many quarters in this still-traditional and deeply religious society. Many gay and lesbian Indians have long felt the need to conceal their sexual identities, and some even marry heterosexuals, because of the stigma attached to their sexuality.

At a news conference, gay rights activists said that they were shocked and discouraged by Wednesday’s ruling. “It’s a black day for us,” said Anjali Gopalan, the founder of the Naz Foundation, a nongovernmental organization that is focused on HIV/AIDS and was the petitioner in the original Delhi case. “I feel so exhausted right now thinking we are being set back by 100 years.”

The 2009 decision decriminalizing homosexuality was controversial. Several religious, political and social groups had filed appeals. The government did not join the appeals, but India’s additional solicitor general said during arguments in the case before the Supreme Court that gay sex was “highly immoral,” touching off a firestorm.

“All religious communities — Muslims, Christians, Hindus — had said that this was unnatural sex,” said Ejaz Maqbool, a lawyer representing religious groups. “Today, the Supreme Court held that the earlier judgment was wrong. Tomorrow, if the nation feels and if the Parliament feels this is a provision that needs to be removed from the Indian penal code, then it can.”

Prakash Sharma, a senior leader and spokesman for the Vishwa Hindu Parishad, a conservative Hindu group, lauded the court’s decision. “A few thousand people who claim to be homosexuals cannot dictate rules for the majority; they cannot decide what is right and what is wrong,” Sharma said.

The homosexuality law wasn’t strictly enforced in the years leading up to the 2009 decision. But gay rights advocates said that ruling had made a big difference in their lives.

In recent years, they said, gay, lesbian and transgender Indians have felt freer to gather and talk about their sexuality openly. Colorful pride parades are more common, and there is even a gay-
oriented radio station
— Q Radio — in Bangalore, the country’s IT capital.

Now gays and lesbians worry that they could again be harassed or blackmailed by corrupt police or criminals, who in the past threatened to turn them in if they didn’t pay bribes. Activists said homosexuals could have trouble getting access to health care and other services.

“Emotionally, it’s a difficult thing for people to deal with, being branded as criminals again,” said Abhinav Goel, 38, co-owner of a travel agency in New Delhi focused on serving gay customers.

Such travel companies had sprouted after the 2009 case, Goel said, and he was now anticipating a drop in his business.

“Clients are wondering if this is a safe country for them,” he said.

A new law in Russia that limits the promotion of nontraditional sexual relationships has prompted some human rights activists to call for a boycott of the 2014 Sochi Olympic Games.

Attorneys for the Naz Foundation said they would put pressure on India’s government to change the law.

But even the most hopeful of advocates think that’s unlikely to happen in the short term, with the country heading toward national elections in the spring. The opposition Bharatiya Janata Party, which made a strong showing recently in four state elections, says the gay rights movement is “un-
Indian” and anti-family.

Dozens of people turned out in the capital to oppose Wednesday’s decision. Wearing black armbands and headbands, they chanted, “My body, my right,” and held signs with slogans such as “Proud to be Gay” and “I’m LGBT — Don’t I have rights?”

“I am shocked that I am living in a country today that wants me to go back into the closet,” said Shaleen Rakesh, a gay rights activist and director of technical support for the India HIV/AIDS Alliance. “I am not going back into the closet.”

Suhasini Raj contributed to this report.