Ryan Campbell, 44, of Brookhaven, was arrested in Ridley Township for indecent exposure.
Investigators say an officer patrolling near the Wawa on MacDade Boulevard and Route 420 saw a car parked strangely around 4 a.m. Saturday.
"He approached the car, saw the driver was leaned back and he was masturbating in the car. The officer also noticed there was a revolver in the passenger seat," said Ridley Township Police Lieutenant John Hamill.
An affidavit says it was a silver handgun with .22 caliber rounds and spent shell casings lying on the passenger seat.
Police say the officer "arrested (Campbell) for open lewdness, took the gun, took the car, and he contacted Tinicum police that he was aware of an incident where a house was shot at and a couple cars were shot up," said Hamill.
Investigators say that the shooting spree happened earlier that same morning in the neighborhood off of 2nd Street in Tinicum Township.
"It's scary. Especially with the little kids, they're always here. What if it happened during the day?" said Paul Cebek, who says his son woke up to this bullet hole in his fianceé's car.
"From my understanding, they took the door apart to get the bullet out," he said.
Also that morning, police say projectiles were shot into several cars in the parking lot of Springfield Mall off of Baltimore Pike.
Police are now testing ballistics to see if there's a match to the gun found with Campbell.
Campbell does have a prior conviction and legally could not possess a firearm, authorities say.
He's in custody on $1 million bail.