NEW DELHI, India (CNN) -- An Indian court on Thursday ruled that consensual sex between adults of the same gender is legal in the country, attorneys said.

An Indian gay activist participates in a gay pride march in Bangalore on Sunday.

Any homosexual act without the consent of either partner remains a criminal offense, however, Indira Jaisingh, counsel for the nonprofit Naz Foundation which had challenged the law, told CNN.

The ruling means the law -- Indian penal code section 377, which had criminalized consensual homosexual acts between adults -- has been partly struck down but remains in place as far as forced homosexual acts are concerned.

The verdict will affect law enforcement all around India because it deals with a law enacted by the federal parliament.

Government prosecutors did not immediately oppose the judgment, Jaisingh said, but they have that option.

India's Ministry of Home Affairs opposed changes to the law on grounds that decriminalizing homosexual conduct would "open the floodgates of delinquent behavior."

Don't Miss

UNAIDS, the joint United Nations program on AIDS, also applauded the ruling, saying it restores dignity and human rights.

It was not immediately clear whether the ruling would eventually lead to legalization of gay marriages in the country.

"This, I think, will be the next level of demand from the gay community," Jaisingh said.

Jaisingh said she has fought for legalization of homosexuality for seven years on behalf of the Naz Foundation. The group says its "primary aim is to improve the sexual health and human rights of marginalized males who have sex with males, their partners and families in South Asia and elsewhere."

The court decision was issued amid plans for federal discussion of Section 377, which has sparked a religious outcry in conservative India.

Christian, Hindu, Muslim and Sikh leaders have warned that they will oppose moves to decriminalize homosexuality.