The government would look at the law dealing with homosexuality and exercise its prerogative in the matter, Law Minister Kapil Sibal said after the Supreme Court on Wednesday held same-gender sex was an offence.

Sibal said it was prerogative of the Supreme Court to test the constitutionality of the law and the government would exercise its prerogative.

"It is the prerogative of the Supreme Court to judge the constitutionality and validity of the law. The opinion of the Supreme Court must be respected by the government. They have exercised their prerogative, now we shall exercise ours," Sibal told reporters outside parliament.

Some MPs also spoke of the need to decriminalise Section 377 of the Indian Penal Code, which holds that same gender sexual relationship was against the order of nature and was an offence.

The Supreme Court Wednesday ruled that consensual sex between adults of the same gender was an offence, asd held in Section 377 of the IPC. It set aside the Delhi High Court verdict of 2009, which had decriminalised sexual relationship between adults of the same gender under that law.

Information and Broadcasting Minister Manish Tewari said the government will take cognizance of the Supreme Court verdict and formulate its response.

He said there have been suggestions in the past that Section 377 should be decriminalised.

"But since a decision has come, the government will take cognizance of it and let you know," he said outside parliament.

Communist Party of India-Marxist (CPI-M) leader Basudeb Acharia said the Supreme Court has left it to the government to change the law on the issue if it so desires.

"The Supreme Court has said the government can make law if it wants," Acharia said.

Janata Dal-United (JD-U) MP Shivanand Tiwari said the Supreme Court verdict was regressive.

"I feel the judgment is regressive. The Supreme Court should reconsider it," Tiwari told reporters outside parliament.

The JD-U leader said homosexuality has been in existence since time immemorial.

"Not accepting it is ignorance. It has been accepted in many other countries and even gay marriages have been allowed," he said.

Minister of State for Home RPN Singh also echoed similar views.

"In my personal opinion, the state must not interfere in two consenting adults' private lives #Sec377," Singh said in a tweet.

Trinamool Congress leader Derek O'Brien said he had spoken about decriminalising Section 377 in 2006.

"Way back in 2006 I spoke up to decriminalize #Sec377 along with Amartya Sen, Vikram Seth, Shyam Benegal & others. My views on gay rights in 2006. No different today," O'Brien said in a tweet.