India’s supreme court has refused to hear a petition challenging a law criminalising gay sex, in a setback for activists battling in the country’s courts to get the ban overturned.

A number of well-known lesbian, gay and bisexual Indians had argued that section 377 of India’s penal code, which prohibits “carnal intercourse against the order of nature with any man, woman or animal”, undermined their fundamental rights by failing to protect their sexual preferences.

“The supreme court refused to hear the matter and asked the petitioners to approach the chief justice of India,” said Arvind Dattar, a lawyer for one of the petitioners.

India’s chief justice is already hearing a separate case to strike down the ban, and India’s top court has previously argued that only parliament has the power to change section 377.

The decision is the latest setback India’s gay community has faced in its fight to get a prohibition on homosexual sex overturned since the supreme court reinstated a colonial-era ban in late 2013.

That ban ended a four-year period of decriminalisation that had helped bring homosexuality increasingly out into the open in a deeply conservative society.

Violation of the law on gay sex can result in a prison sentence of up to 10 years.