NEW DELHI — India's government on Wednesday asked the country's top court to rule on whether to repeal or keep a controversial law that criminalizes homosexual acts.

Government attorney Tushar Mehta asked the court to rule on the issue of consensual sexual acts between two adults. He urged the five justices not to widen the scope of the court decision to issues like gay marriages, adoption and inheritance.

The Supreme Court is hearing petitions by activists challenging the law that makes gay sex punishable by up to 10 years in prison.

"We leave to the wisdom of the court to deal with the validity of Section 377 (of the penal code) so far as it relates to consensual sexual acts between two adults," the Press Trust of India news agency quoted Mehta as telling the five justices hearing the issue.

The judges said the court would test the validity of the law in relation to consensual sexual acts between two adults. It said if it decided to strike the law down, it would remove the ban on homosexuals from joining the defense services, contesting elections or forming associations, PTI reported.

Activists had cheered in 2009 when the New Delhi High Court declared the law unconstitutional. But the judgment was overturned in 2013 when the top court decided that repealing the law should be left to Parliament, not the judiciary.

Over the past decade, homosexuals have gained a degree of acceptance in India, especially in big cities. Many bars have gay nights, and some high-profile Bollywood films have dealt with gay issues.

Still, being gay is largely seen as shameful in most of the country, and many homosexuals remain closeted.