When social media emerged in my country almost 10 years ago, my peers and I were excited. Here was a space where Chinese people like us could share everything, we thought, from bits of daily life to our unvarnished views on public affairs. We were naïvely optimistic back then about the prospect, as a famous phrase at the time put it, of “onlookers changing China.”

Things did not turn out that way. Nearly a decade later, the growing silence on social media when it comes to sensitive public issues is deafening. Most of us now refrain from posting things that are potentially controversial. That’s in part because of tightened censorship. But it’s also because of a phenomenon called “renrou sousuo,” or “human flesh search” — the deliberate marshaling of the forces of the internet against those deemed harmful to the public good. This, in its own way, has been just as responsible for the chilling effect.

The term sounds creepy — and it is. “Human flesh searches” are all about punishing people whom the cyberspace masses decide are deserving of public attention and scorn. It’s effectively an effort to use crowdsourcing to reveal and broadcast the real-life identities of those who had been essentially anonymous online — call it doxxing with Chinese characteristics.

Such searches can delve into territory like people’s whereabouts, their relationships and even details about their relatives and close friends. People’s lives and careers can be ruined, even their safety jeopardized, once they’ve been targeted by such a hunt.

When the phenomenon arose in China in the late 2000s, its targets were typically morally unambiguous.One of the earliest cases involved a woman who posted acts of animal abuse online — one example included stomping a kitten to death with stilettos — and stirred up anger across the nation.

The practice was soon picked up by people seeking to expose the extravagance of allegedly corrupt, or at least not public-minded, local officials. In 2012, for instance, a man who appeared to be a party cadre was captured on video grinning at the scene of a bus crash that had killed 36 passengers in Shaanxi Province. The internet was furious. Soon this person’s name and position were unearthed, along with his expensive tastes: designer watches, belts and eyeglasses that were incompatible with his supposedly meager government pay. Social media users labeled him Watch Uncle and he was eventually dismissed from his post.

At the time, some believed that in a society where justice through the judicial system remains elusive, this kind of citizen-driven hunt had a role to play as a sort of ad hoc, ground-up form of the rule of law. It was also perhaps the only way for ordinary Chinese citizens to offer some sort of check on the excesses of government officials.

But these sort of quasi-juridical activities quickly subsided. Potential targets learned their lessons and started keeping lower profiles. The government began pushing its own anti-corruption campaign later that year, which meant that officials became much more cautious about anything that might hint at a luxurious lifestyle and also that spontaneous exposure of official wrongdoing outside state-run media would no longer be tolerated.

And so in recent years, more often than not, human flesh searches have been associated with rising ultranationalism in China. Vigilantes today dig through people’s comments online for any sign of unpatriotic sins. Today, in addition to renrou sousuo, we have another creepy term for these activities: “ba pi,” which literally means “to skin,” that is, to expose.

One of the most high-profile cases of this unfolded in the summer of 2017, when Yang Shuping, a University of Maryland student from China, delivered a graduation speech in which she drew a parallel between China’s air pollution and its restrictions on free speech.

She was immediately a target of renrou sousuo: The state-owned media depicted her as an unpatriotic traitor belittling the homeland, while angry netizens spread everything they could find out about her, including the address of her family back in China. Death threats were made on social media, and there were rumors, difficult to confirm, that some social media users even paid a visit to her parents’ home. Ms. Yang eventually apologized and deleted all her posts on Weibo, the Chinese equivalent of Twitter.

More recently, a victim of the Ethiopian Airlines crash in March, a young Chinese woman, unexpectedly became a target. The animosity toward her after her tragic death appears to have been prompted by a combination of nationalism and class resentment: Photos she’d posted showed that she was probably from a well-to-do family, and there were rumors that she’d had a foreign boyfriend.

Social media users dug up her Weibo account, worked out what school she’d attended and spread around old pictures. “When I see you staying in a hotel that costs thousands of yuana night, eating fancy food, and that you can afford to fly to Kenya when you want to see giraffes, even though I won’t say I’m happy for your demise, I definitely do not have sympathy for you,” one commenter wrote. Another said, “Our country isn’t vast enough for you to spend vacation time in?”

I am not arguing that all those targeted have been innocent. There have been occasions during which the tens of thousands of internet users who have mobilized to “right wrongs” were fueled by legitimate motives. Yet whether the questionable behavior concerns fortune flaunting, supposedly unpatriotic political views or expensive vacations, society needs to consider how much public harassment or privacy invasion, if any, is justified.

As a formerly outspoken social media user who once had a big following, I have experienced my own share of online abuse. I’ve been inundated with personal attacks and photos intended to intimidate, though nothing as horrifying as a human flesh search. That I have since opted to lay low and stay relatively silent on social media is not a coincidence. It isn’t just me: Fear of zealous vigilantes on the internet has led more and more people to restrict unorthodox political views or anecdotes of their private lives to family and close friends.

Human flesh searches had remained generally unfettered by regulations until 2017, when the Supreme People’s Court and the Supreme People’s Procuratorate announced that depending on the severity of the invasion and dispersion of personal information, a perpetrator could get jail time. It remains to be seen, however, whether this regulation will simply be applied selectively to punish those the authorities dislike, as has happened in the case of restrictions on “rumor spreading.”

We cannot count on vigilantism to change Chinese society for the better. It ought to be an independent legal system — the sort that we lack — rather than outbursts of internet fury, public humiliation, mass intimidation and populist vengeance that are responsible for upholding justice. Nor can cyberbullying ever lead to real patriotism.

And everyone is entitled to privacy protection, even those whose morals might seem dubious, because privacy and freedom of speech are like two sides of a coin: Each is required for the other to thrive. And the last thing a country desperate for freer expression needs is a self-righteous crowd doing the authorities’ work for them.