India’s Supreme Court has struck down as unconstitutional an Internet law that provided for the arrest of people sending online messages considered offensive or menacing.

The court struck down on Tuesday section 66A of the Information Technology Act, describing it as vague, and said it did not fall under reasonable restrictions on free speech.

The decision by the Supreme Court follows a bunch of lawsuits that alleged that this section of India’s cyberlaw was a threat to free speech in the country, and had led to arbitrary arrests.

“This is a clear win for democracy and free speech,” said Mishi Choudhary, a lawyer focused on technology. She added that the Supreme Court had proven to be “very tech-savvy.”

One petition filed in 2012 by a student, Shreya Singhal, asked India’s top court to strike down section 66A, saying it violates Articles 14, 19 and 21 of India’s Constitution which are concerned with basic rights including freedom of speech. Singhal’s lawyer described the section as vague and arbitrary.

Section 66A made it punishable by a fine and imprisonment of up to three years if a person used a “computer resource or a communication device” to transmit a message that is “grossly offensive or has menacing character.” It also makes it an offence if a person transmits information known to be false to cause, among other things, hatred, enmity or ill will.

The law was used to target a variety of online comments, ranging from attacks on controversial politicians to remarks that were considered to be religiously offensive.

The federal government was not immediately available for comment on the court order. Prime Minister Narendra Modi and his cabinet are known to be tech-savvy, and have used Twitter and other social media to promote themselves and the government’s programs.

“It would have been nice if Modi had on his own scrapped the law,” said Choudhary. “It was a great opportunity that he missed.”

The Supreme Court has, however, upheld the right of the government to block content on the Internet in certain cases.