As the world’s most populous democracy, India by rights should be a beacon of free speech. Yet there the country was last week, at the center of yet another embarrassing controversy over a book.

Penguin Books’ Indian unit announced it was withdrawing Wendy Doniger’s massive 2009 tome “The Hindus: An Alternative History,” which was published in India in 2011. Ms. Doniger, a professor at the Divinity School of the University of Chicago, is a world-renowned academic authority on Hinduism. Her book offers a light-toned personal interpretation of the faith, its myths, and its use of symbols—admittedly not always in line with orthodox Hindu interpretation.

The book was controversial from the start. Some offended Hindus wrote spirited rebuttals. Others signed petitions criticizing the book. One aggrieved group, the Committee to Campaign to Protect Education, sent Penguin a legal notice, saying the book should be withdrawn because it offended Hindu sentiments, particularly in the way in which Ms. Doniger allegedly offered a sex-based interpretation of certain texts.

Penguin fought the case for four years, but capitulated in the end in a settlement before any court ruling. Penguin has not shied away from controversy in the past. The publisher kept Salman Rushdie’s “The Satanic Verses” in print world-wide even after Ayatollah Khomeini issued his fatwa in 1989 against it, and in an earlier generation stood trial under British obscenity laws for publishing D.H. Lawrence’s “Lady Chatterley’s Lover.” But in this case, executives apparently decided they couldn’t risk running against Indian law “however intolerant and restrictive” it may be, as the company said in its statement.

That statement singled out S.295A, a colonial-era provision in the penal law that makes “deliberate and malicious acts intended to outrage religious feelings of any class by insulting its religion or religious believes” punishable with imprisonment or fines or both, making it “increasingly difficult for any Indian publisher to uphold international standards of free expression without deliberately placing itself outside the law.” The company also noted it was morally responsible for the safety of its staff, a telling remark about which more later.

Illustrating the bind in which many publishers in India find themselves, Penguin’s concession to opponents of free speech was greeted by outrage among proponents of free speech. Two other authors on the publisher’s list, Jyotirmaya Sharma and Siddharth Varadarajan, publicly asked Penguin to pulp their books and instead revert the rights back to them so they could find alternative publishers.

Both have reason to worry they could be censorship targets too. Mr. Sharma has written books critical of Hindu nationalism and Mr. Varadarajan has written a book that criticizes the handling of 2002 Gujarat massacres by Narendra Modi, the state’s chief minister and now a leading contender to be the next prime minister at the helm of the Hindu nationalist Bharatiya Janata Party.

Publishers are left to navigate these shoals as best they can, and it’s more art than science. In 2011, Oxford University Press withdrew editions which carried the late poet A.K. Ramanujan’s essay “Three Hundred Ramayanas” after Hindu nationalist groups objected to the essay being part of a reading list at Delhi University. Following an outcry, OUP said it would republish the essay and other works of Ramanujan.

But the real problem, as hinted at by Penguin’s remark about the safety of its staff, is that publishers too often don’t enjoy sufficient legal protections for their work. Not only is the law as it stands too friendly to groups of any stripe that want to gin up dudgeon over controversial works (and also too friendly to businesses or individuals who want to claim that any unflattering coverage is defamatory). But the authorities too often fail miserably at the basic policing that would ensure protests over books remain peaceful.

Penguin surely had in mind the fact that Hindu nationalist groups’ protests have not always been non-violent. Over the past two decades, they have vandalized art galleries that show the works of Indian artists like the late M.F. Husain, and more recently, Pakistani artists. They’ve threatened cinema halls showing films they disapprove of. And the list of incidents goes on. Any publisher courting controversy must bear in mind the physical risks of doing so.

While the police and other authorities are so often derelict in their basic responsibility to maintain public order, Indian law tries to shift the blame for these protests onto the protestees, even though a Supreme Court judgment from 1989 explicitly asks the authorities to protect free speech. Another colonial-era law, S. 153A, empowers the state to prosecute anyone committing an act prejudicial to maintaining harmony—which can be construed to include publishing books that stir up violent protests and not merely those who directly incite others to violence.

Given this background, Penguin’s pragmatism is understandable—indeed, Ms. Doniger, in her statement, doesn’t blame her publisher, but the law. Not only would the publisher have good reason to worry about the safety of its staff if protests were to escalate and the police to demonstrate their customary lack of interest. Publishers also must balance their desire to challenge unjust laws on the one hand with their responsibility to their shareholders to act lawfully in the places where they do business on the other.

Hindu nationalists have every right to voice objections to works they find offensive, and even to do so by gathering peacefully in the streets if they want. But the state fails when it can’t ensure basic security during such protests, and even more so when it tilts the legal balance against free speech.

Indian laws serve Indian democracy poorly—stifling debate, preventing inquiry, smothering imagination, and closing the Indian mind. If there’s one lesson from the latest Penguin affair, it’s that it’s time for New Delhi to stop treating a nation of a billion people as infants who should be protected from controversial thoughts.