About 8:40 a.m., police said, the man had entered the 54th and Wyalusing Food Market, brandished a 9mm pistol, and demanded money from the female employee behind the counter.
As she handed over $40 from the cash register, her husband - a former Dominican police officer known to the neighborhood as "Papi" - crept from the back of the store, semiautomatic in hand, to confront the thief, police said. He had spotted the man on the store security camera and waited to confront him after his wife handed over the cash.
But the 31-year-old man saw store owner Fercido Nunez and fired two shots, police said. Nunez, 39, fired four shots back.
In the cross fire, a child no older than 10 opened the front door of the store, police said. A neighbor whisked the child to safety as the robber ran past with Nunez in pursuit.
On the corner, the robber, still holding his gun, turned to face Nunez, who fired twice, hitting him in the stomach and a leg, police said.
On Friday afternoon, police cordoned off the area around the bodega as onlookers chatted and craned to get a glimpse of the thief's jacket, abandoned in the street, and the two handguns on the sidewalk.
Neighbors said the bodega, known locally as "the Papi store," was a popular spot for children stopping by on their way to school to buy drinks and snacks.
Kevin Dabney, 44, who lives across from the store, called Nunez and his family "very pleasant people," and added that he could not remember any robberies there. Still, neighbors said, there has been an uptick in armed robberies in recent weeks.
Nunez's daughter, Katherine, said that her father's shop had never been robbed but that he kept a gun handy just in case. Her father has owned the store for three years.
Lt. John Walker of Southwest Detectives said Nunez had been cleared in the investigation and would face no charges. Nunez had a permit for his gun, Walker said.
The robber, whom Walker would not identify, is well-known to police. He has been charged with attempted murder, robbery, and aggravated assault, Walker said, and was in critical but stable condition at the Hospital of the University of Pennsylvania.
Outside the bodega Friday afternoon, neighbors said they were upset by the shootings and were standing behind Nunez.
"It's just sad that every day we walk outside and have to be mindful of the fact that something like this could happen," Dabney said. "I feel most bad for the kids. They're innocent. They don't even know what's going on."
Contact Aubrey Whelan at 215-854-2771, email@example.com, or follow @aubreyjwhelan on Twitter.