On Saturday afternoon in the Bronx, a 12-year-old boy was playing with his friend in the courtyard of their apartment building, swinging a baseball bat at an orange construction cone.
The boy, Jacob Freytes, said they could do better than a cone. What they needed, he said, was a ball, and he decided to bike two blocks to a bodega to buy one.
The friend, Simon Garcia, 14, was wary. “I said, ‘Be careful,’” Simon said on Sunday. His parents had warned him about walking to the bodega at the corner of Walton Avenue and Elliot Place in the Mount Eden neighborhood, even when it was light outside.
Still, Jacob went. Hours passed, afternoon turned to dusk, but the boy had not returned.
“I was thinking, ‘Why is he taking so long?’” Simon said.
Just before 5 p.m., Jacob was fatally shot by a stray bullet outside the bodega, Wanda Deli.
William Ferrer, 45, of the Bronx, was arrested and charged on Sunday with second-degree murder in Jacob’s killing, the police said.
The boy had been outside when Mr. Ferrer, who was arguing with five other people, pulled out a gun and shot into the group, according to three law enforcement officials who spoke on the condition of anonymity because they were not authorized to discuss the case publicly.
Vincent Vallelong, the president of the sergeants’ union, said Jacob is the son of Jesus Freytes, a retired detective sergeant.
“Losing a child is every parent’s worst nightmare,” Sergeant Vallelong said. “Our hearts go out to the Freytes family as we pray for them during this unimaginable and painful tragedy.”
Mr. Ferrer is also accused of shooting a 34-year-old man in the left foot and a 25-year-old man in the buttocks, and faces additional charges including manslaughter, attempted murder, assault and weapons possession, the police said. The two men were expected to survive.
In a social media post on Sunday, Police Commissioner Jessica S. Tisch wrote, “Jacob was an innocent bystander on his bike when he was taken from his family yesterday in an act of senseless gun violence.”
“No arrest can ever ease the pain of this unimaginable loss, but the N.Y.P.D. will continue to do everything in our power to seek justice for Jacob,” she added.
A cashier at the bodega, Mani Soto, said Jacob bought a ball around 4:45 p.m. The boy thanked him and left.
Moments later, Mr. Soto said he heard the sound of gunshots.
“The kid came running in, his arm was bloody,” said Mr. Soto, 31. He heard Jacob cry out, “‘They hit me, they hit me!’” Then the boy dropped to the floor.
Officers arrived just before 5 p.m. and found Jacob, who was shot in the left shoulder, the police said. Emergency medical workers took him to Lincoln Hospital, where he was pronounced dead.
On Sunday, outside the bodega, pink rose petals were scattered on the sidewalk near half a dozen candles.
Two blocks away, at his apartment building on Marcy Place, Simon gazed at the flickering candles featuring the Virgin of Guadalupe placed on top of a wooden crate steps from where the boys had swung a bat the day before.
About 15 other friends and family members also gathered around the makeshift memorial. Among them were Jacob’s aunt and his 7-year-old sister, Luna, who drew a heart on the crate and wrote “you I luv.”
At the foot of the memorial, mourners had placed a baseball, a football, a Capri-Sun drink and Jacob’s green Fuggler, a popular plush toy. A framed photograph of Jacob stood at the center with the words “In Loving Memory,” above his nickname, Kai.
Milagro Dejesus, 58, who has lived in the building for nearly five decades, looked on as she comforted another neighbor.
“He grew up with everybody else’s kids,” Ms. Dejesus said. “We all saw him grow up. All the kids here grew up as a family.”
Jacob was the kind of child who would dance the Bachata with his mother and help older tenants with their groceries, Ms. Dejesus said. “Now, we don’t have him,” she said. “It’s not going be the same without him.”