One of the gunmen, Mr. Mohammed said, hung a poster in which Hamas’s Al-Qassam Brigades claimed responsibility and cited Mr. Ouaida’s alleged crimes.

By noon, at least 100 men and boys, some carrying prayer mats, had gathered around Mr. Ouaida’s body, covering his bloodied head with a plastic sheet. He was wearing blue pants and a black zip-up sweatshirt and his feet were bare, and one dusty sandal sat by his hand. Another 15 minutes elapsed before an ambulance took him away.

The brazen nature of the killing suggested that Hamas, which governs Gaza, intended it as a blunt message to other possible collaborators with Israel, which is believed to have an extensive network of informants here as part of its underlying battle with the group. But the shooting evoked mixed feelings.

“There were kids and children on the street,” said the witness, Mr. Mohammed. “They should have executed him in a far place.”