“The legal system is seen by many people as too lenient for petty theft,” said Sana Jaffrey, a doctoral researcher at the University of Chicago who ran the World Bank program for five years. For many poorer residents, she said, the loss of a motorbike, or even something as minor as chickens, could greatly damage their livelihood. When convicted thieves are released from jail after just a few months, as is common, it creates a perception that the legal code is too lenient, she said.

Nonetheless, the killing in Bekasi struck a particular chord, in part because Mr. Zahra made his living selling electronic equipment, so the amplifier he was accused of stealing may have been acquired legally.

Celebrity preachers swarmed Mr. Zahra’s rented home to meet with his widow, Siti Zubaidah, 25, and denounced lynching as un-Islamic. Indonesia’s vice president, Jusuf Kalla, a multimillionaire, dispatched a representative to visit Ms. Siti, who is six months pregnant, to pledge financial support.

An Islamic center promised to donate around $19,000 so she could buy a house. And ordinary citizens from Jakarta delivered food and money to the family.

Last week, Bonny Siddarta, 36, who works at a dog shelter in Jakarta, made a long trip from the city to visit the family and donate $900 that he had raised online. He said he was shocked by the killing.

“They judged him so speedily,” he said. “‘This one must die. This one insulted Islam.’”

Mr. Siddarta said he hoped the case would be a turning point for Indonesia, but worried that it would not be.