"The public's right to know is directly affected by Section 66(A)," he added.
Information Technology Minister Ravi Shankar Prasad later said his government would come up with an amended law if needed, after "widest consultation". But he also added, "Those who are in power must be liberal, India is a free country."
The court had been asked to examine the legality of Section 66(A), which makes sending information of "grossly offensive or menacing character" punishable by up to three years in jail.
"Nobody should have fear of putting up something because of the fear of going to prison," said Ms Singhal, adding that after today's verdict, hate speech will be dealt with under other laws that govern the Internet.
The contention by most of the petitioners was that Section 66(A) is vague and allows the police arbitrary interpretation and misuse of the law. The previous government, headed by the Congress, said that the law was necessary to combat abuse and defamation on the internet. The new BJP government also defended the law in court. "The government was willing to come up with additional stringent guidelines to prevent misuse of 66(A)," said Mr Prasad.
Critics of the law said it was misused by political parties to target their opponents and dissidence. A professor in West Bengal was arrested in 2012 for posting a cartoon of Chief Minister Mamata Banerjee, for example.