You better think twice before “Liking” your friends’ comments on Facebook. It may land you in jail.

In a case that is worrying freedom of speech activists, two women were temporarily detained in Palaghar, a city 100 kilometers from Mumbai, in relation to a comment posted on Facebook on right-wing Hindu leader Bal Thackeray, who died over the weekend.

The comment did not explicitly criticize Mr. Thackery or his supporters but questioned why it was necessary to effectively shut down the city for his funeral.

Mr. Thackeray, who passed away on Saturday at the age of 86, was the head of the Shiv Sena, or Shiva’s army, a right-wing party he founded in the 1960s with the aim of promoting the interests of local Hindus over immigrants in Mumbai’s state of Maharashtra.

After his death was announced, shops, restaurants and other businesses in Mumbai closed either as a show of respect or in fear of mob violence by Shiv Sena supporters. Despite some reports of unrest, Mumbai remained mostly peaceful throughout the weekend.

According to the Mumbai Mirror, Shaheen Dhada, 21, posted the following on Facebook: “People like Thackeray are born and die daily and one should not observe a bandh for that.” Bandh is Hindi for strike.

The comment was removed after a case was registered against the girl for allegedly hurting religious feelings through social media, according to Shrikant Pingle, a police inspector from Palghar, a Mumbai suburb. The case was registered in response to a complaint filed by Bhushan Sanke, a local Shiv Sena activist.

Police also registered a case against another woman, Rinu Srinivasan, for “liking” the comment.

The two women were detained on Monday morning and released on bail in the afternoon, according to Mr. Pingle, who is conducting the inquiry. The two women were not reachable for comment. Their lawyer, Sudhir Gupta, told news channel NDTV: “Their posts don’t incite violence. It can’t be said they have made any derogatory remarks.”

Sanjay Raut, a member of the Shiv Sena in Mumbai, said that he had no knowledge of the incident. “But if someone has said something like that about a leader like Balasaheb Thackeray, I don’t think [a police complaint] is wrong,” he said, describing the comment posted on Facebook as a “misuse of social networks.”

Parts of a hospital run by a relative of Ms. Dhada were allegedly vandalized by Shiv Sena activists angered by the Facebook post, according to a hospital official. According to reports, a police complaint has been filed against the vandals, but no arrests have yet been made. Mr. Raut had not heard of the alleged attack in the hospital so declined to immediately comment.

Many condemned the incident as a violation of freedom of speech.

Justice Markandey Katju, the chairman of the Press Council of India, the country’s main media body, said: “To my mind it is absurd to say that protesting against a bandh hurts religions sentiments. Under Article 19 (1)(a) of our Constitution freedom of speech is a guaranteed fundamental right.”

“We are living in a democracy, not a fascist dictatorship,” Mr. Katju, a former judge in India’s Supreme Court, wrote on his blog in an open letter addressed to the chief minister of Maharashtra. He also cautioned that, if reports are confirmed, legal action should be taken against police.

“The police have failed in their duty to protect the girl and her family,” says Pranesh Prakash, policy director at the Centre for Internet and Society, a Bangalore-based research group. He described this attempt to regulate free speech as “unconstitutional.”

This isn’t only about controlling social media but about freedom of expression on the whole, he says.

“Bal Thackeray had violated the same provisions in his lifetime,” noted Mr. Prakash, with reference to Mr. Thackeray’s inflammatory speeches against the South Indians and Muslims.

In the past too, the Shiv Sena has forced censorship in Maharashtra. Supporters of the Shiv Sena, in 2010, successfully pressured Mumbai University to remove from its reading list Rohinton Mistry’s book “Such a Long Journey,” which is critical of the Shiv Sena.

Authorities in India have been criticized for not doing enough to protect freedom of expression. A cartoonist was recently put behind bars accused of sedition, a charge that was later dropped.

Local and central government authorities have defended their policing of the Web in the past, arguing that they must remove content that could spark riots, communal unrest or general public disorder. That’s the line the government took when it blocked out some Twitter handles and Web sites during a recent spate of ethnic violence in the northeast.

This copy is for your personal, non-commercial use only. Distribution and use of this material are governed by our Subscriber Agreement and by copyright law. For non-personal use or to order multiple copies, please contact Dow Jones Reprints at 1-800-843-0008 or visit www.djreprints.com.