It happened around 6 p.m. Saturday on the 1600 block of Walnut Street.
Police say a group of juveniles started randomly assaulting pedestrians in the area.
People who were there said it was frightening.
"It's crazy out here," said Dwight Magood. "I don't know if they were trying to protest or 'flash mobbing.' But it's not the right way to do it, whatever it was."
Magood said people ran into nearby stores to escape the chaos.
As the violence unfolded, police say an off-duty Philadelphia detective saw a 21-year-old man being attacked and moved closer to intervene, but the group fled.
As the detective walked back to where his wife was standing, police say, he saw another group attacking two women, ages 20 and 21.
When the detective announced he was a police officer and moved in to arrest one of those attackers, several others started punching him.
That's when the detective's wife splashed water on one of those suspects to get him to stop punching her husband, and she was then punched in the face.
All those attackers then fled.
A short time later, police say, a 28-year-old man was attacked around the corner, in the 100 block of South 16th Street.
In all, police say, six people were hurt.
Two of them declined medical attention. The others were treated at Thomas Jefferson University Hospital.
The most seriously injured was the detective, police say. He suffered a fractured eye socket.
Police took two 16-year-old boys into custody. They are facing assault charges in connection with the attack on South 16th Street.
Investigators say they are working to gather video and other evidence they hope will lead to arrests in the other attacks.
Anyone with information about the incident is urged to contact Philadelphia Police.