New Delhi, India (CNN) -- Sex between consenting homosexual partners is once again illegal in India after the country's Supreme Court overturned a lower court ruling Wednesday.
Four years ago, India's High Court decriminalized such a relationship, in what was then hailed by gay rights groups as a landmark ruling.
The Supreme Court overturned that ruling.
Known as Section 377, the law has been in the books since India's Colonial-era days. It bans people from engaging in "carnal acts against the order of nature."
On Wednesday, the Supreme Court ruled that the penal code was constitutionally valid.
It was up to parliament, the court said, to decide whether or not to keep the law in the statute books.
Seven year fight
In 2009, the non-profit Naz Foundation won a verdict from New Delhi's high court after a seven-year legal fight to decriminalize homosexuality.
It argued that the law infringed on the right to equality, privacy and dignity as set out in India's Constitution.
The High court ruled in Naz's favor. But the decision came under fire from Christian, Hindu and Muslim groups, who filed an appeal to the Supreme Court.
India's central government did not appeal, saying it didn't disagree with the High Court's ruling.
Amnesty International India called Wednesday's Supreme Court ruling "a black day of freedom in India."
"It is hard not to feel let down by this judgment, which has taken India back several years in its commitment to protect basic rights," the group said.
'Setback to human dignity'
Until now, India hasn't maintained a central database of prosecution under Section 377, said Akhilesh Kumar, a chief statistical officer at the National Crimes Record Bureau (NCRB).
"Henceforth, we will be compiling crimes committed under this relevant section," Kumar said. "Maybe from the next year."
Rights activists say a number of gay couples have faced court cases because of their relationships.
"There have been hundreds of trials under Section 377 in different parts of the country," said Colin Gonsalves, a human rights lawyer. He said the law also rendered gay couples vulnerable to what he called harassment by police.
The New York-based group Human Rights Watch called on the Indian government to take steps to scrap Section 377.
"The Supreme Court's ruling is a disappointing setback to human dignity, and the basic rights to privacy and non-discrimination," the group said in a statement. "But now the government should do what it should have done in the first place and seek to repeal section 377."