Muhammad and his friends sat on a bench for a while before the three got up and Muhammad began punching Ellerbee, police said.
During the fight, one of Muhammad's friends, who has not been identified by police, pulled out a firearm and hit Ellerbee over the head with it, prompting Zsaron Simpson, 24, to come to Ellerbee's defense, McGinnis said.
That's when the gunman shot Ellerbee in the chest and Simpson in the stomach, police said.
The bullet that hit Simpson went through his body and grazed Muhammad's left arm, McGinnis said.
"When you have a crowded situation, bullets don't care where they go, and that's perfect proof right there," he said.
Muhammad and his pals fled in a Buick, police said. But when the car was pulled over by foot patrol officers at Rising Sun and Adams avenues, only Muhammad was in the vehicle, leading police to believe that he let his accomplices out at some point along the way, McGinnis said.
It was only after police discovered blood in the vehicle and made Muhammad remove his coat, that police discovered his wound, according to McGinnis.
Muhammad, of Bala Cynwyd, was treated for his injury and released into police custody. He was charged with attempted murder, aggravated assault and related offenses.
Ellerbee, of Cherry Hill, and Simpson, of Philadelphia, remained last night at Aria Health's Torresdale campus in stable condition, police said.
Muhammad's two friends, including the gunman, are on the loose.
McGinnis said those who visit the World Gym on Tuesday nights are not required to be members but must pay $10 to gain entry.
About 50 people were still on scene when police arrived Tuesday, he said, noting that it was miraculous that there were not more injuries.
"To think people go to the gym trying to stay healthy and this happens," he said.