Jovan said his first thought was that a gang confrontation had just erupted. He said he remained indoors for fear of being caught in crossfire.

Outside, Mr. Reyes had been wounded in the torso, and he was pronounced dead at Woodhull Medical and Mental Health Center, the police said. The three officers involved in the shooting were not hurt.

Image The gun found at the scene. Credit... New York Police Department

The police said on Sunday evening that they were investigating the shooting and the robbery that preceded it.

Mr. Reyes lived a few blocks from the bodega, in a small, brick-front apartment building on Wilson Avenue. On Sunday evening, Mr. Reyes’s father, Antonio Tlapanco, 48, wept as he stood next to a memorial to his slain son: a framed photograph of Mr. Reyes placed on a kitchen table alongside two floral bouquets in vases, candles and an illustration of the Madonna.

Mr. Tlapanco, speaking through a Spanish interpreter, said that his son had never been in trouble with the police and that he never carried firearms or weapons of any kind. “I would have known,” said Mr. Tlapanco, who said he regularly checked the contents of all of his children’s backpacks.

“The truth is, I don’t know where that came from,” Mr. Tlapanco said of the black pellet gun. “I never saw it around the house. If I would have seen something like that, I would have taken it away from him.”