A man shot and killed a would-be robber who was riding a bicycle and wielding a gun in the Lower Moyamensing section of South Philadelphia late Wednesday night, police said.

Just before 11:30 p.m., on the 2200 block of South Sixth Street near West Moyamensing Avenue, a 30-year-old man on a bicycle approached a 24-year-old man who was standing outside his home smoking a cigarette, police said. The man on the bike said he was going to rob him, at which point the 24-year-old pulled out a gun and shot at the man as he was dismounting from the bicycle.

When officers arrived, they found the bicyclist on the street with a gunshot wound to his head. The alleged assailant fell unconscious as he was rushed to Jefferson University Hospital and pronounced dead hours later, around 2 a.m. Thursday.

Chief Inspector Scott Small said the man on the bicycle managed to shoot one or two times after he was shot in the head, but did not hit anyone.

The 24-year-old had a license to carry his gun, said Small. Police have not identified either the shooter or the robber.

On Thursday afternoon, the man who shot his alleged assailant was not up to talking about the incident, a relative said. “He’s traumatized. We all are traumatized. I’m still trying to process this,” said the man’s aunt, who answered the door at the home.

Police said their preliminary assessment was that the shooting was justified but the final determination was up to the District Attorney’s Office.

Neighbors said they understood why the man had shot the robber.

“He’s a human being,” Qaisar Khan, 26, who with his family has lived in the community for 18 years, said of the slain man. “But you can’t be out here robbing people. There’s a lot of people struggling, but we go to work to make our own money.”