The dog walker, Stanford said, "then pulled the officer's hooded sweatshirt up over the officer's head so that it covered his face," and proceeded to assault the cop from behind.
The officer drew his Glock pistol from his hip holster and shot his assailant in the right thigh, Stanford said, ending the attack.
The alleged assailant, who was treated at Albert Einstein Medical Center, was arrested and will be charged with aggravated assault, police said.
The officer was treated for facial lacerations and bruises, and will be placed on administrative duty pending the outcome of an Internal Affairs investigation.
Fortunately, the confrontation did not end like a 2012 incident in Tacony, where Tyrirk Harris let his dogs defecate in neighbor Franklin Manuel Santana's front yard, then fatally shot Santana in the face for complaining about it.
Harris is serving 20 to 40 years in prison for third-degree murder.
Last year, police Sgt. Eric Gripp created a #PoopIsntWorthPrison hashtag on Twitter.
"Just give us a call and we'll take care of it," Gripp tweeted to @PhillyPPD's 34,000 followers.
Apparently, the dog-poop assailant isn't one of them.
"The overall message was that people shouldn't get into disputes over things like this and just respect your neighbors and other citizens," Stanford told the Daily News.
"Simply put, just be a good citizen. But in this case, it appears that this male did just the opposite. In fact, he went home, then returned just to pick a fight and assault someone, which created a calamitous situation for all involved."
On Twitter: @DanGeringer