Police say it started as a robbery on a Broad Street Line train near the Hunting Park Avenue stop.
[Ads /]
The victim of the robbery was armed and opened fire on the attackers.
ALSO SEE: SEPTA vows 'aggressive' approach to combating gun violence amid recent deadly bus shootings
The man, who had a permit to carry, pulled out his gun during the struggle.
Police say the gun went off during the altercation, missing the attempted robbers but striking a 22-year-old bystander. He was rushed to Einstein Medical Center, where he was listed in stable condition.
[Ads /]
Police have not charged the shooter at this point but have since identified 23-year-old Marquan Best and 21-year-old Trevon Gordon as the robbery suspects and took them into custody.
RELATED: Check the 6abc Neighborhood Safety Tracker