In a landmark ruling, India’s apex court struck down a law that allowed the government to jail citizens for up to three years for posting “offensive” content on the Internet.

The contentious law, known as section 66A under the 2009 amendment to India’s Information Technology Act, was deemed unconstitutional by the Supreme Court on Tuesday.

“Section 66A of the Information Technology Act, 2000 is struck down in its entirety being violative of Article 19 (1) (a) and not saved under Article 19 (2),” the court said in its judgment, referring to the portion of the Indian constitution that guarantees every citizen the right to free speech and expression.

The court’s decision, in response to a 2012 petition from law student Shreya Singhal, caps a three-year long legal battle and was met with jubilation among proponents of free speech.

“The Internet is so far-reaching and so many people use it that it is very important for us to protect this right today, now,” Singhal told AFP on Tuesday after describing the ruling as a “big victory.”

Successive governments in India have grappled with issues of online censorship and free speech, and Singhal’s petition came after a slew of arrests related to 66A in 2012 — including two young women who criticized the shutdown of India’s financial capital Mumbai over the death of a local politician. Earlier, the New York Times had reported that then telecommunications minister Kapil Sibal had asked websites like Facebook, Google and Yahoo to screen objectionable content and prevent it from being published.

The new government under Prime Minister Narendra Modi has had its fair share of censorship battles, including a recent ban on a controversial British documentary about the infamous 2012 New Delhi rape case. The government also justified section 66A in February, calling greater Internet regulation necessary even after admitting the law was “draconian.”

However, the Supreme Court judges said that “assurances of the government that it will not be misused” was not enough to justify the law, which uses terms like “grossly offensive” and “causing annoyance, inconvenience … enmity, hatred or ill will,” that they deemed too vague and easy to be misconstrued.

The court upheld section 69A of the act, however, which allows the government to block online content, and section 79(3) which makes intermediaries such as YouTube or Facebook liable for not complying with government demands for censorship of content.

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Rishi Iyengar at rishi.iyengar@timeasia.com.