Police spokesman Lt. Frank Vanore said the department learned Wednesday that the state police were "investigating a member of the department for committing a crime outside Philadelphia."
The department launched its own Internal Affairs investigation of the incident, he said.
Gallagher, who joined the force in 1978 and spent a portion of his career working in the Traffic Unit, abruptly retired Tuesday.
"I haven't spoken with him yet, but I do know he retired," said John McNesby, the president of the Fraternal Order of Police Lodge 5.
McNesby said that the union would represent Gallagher if he faced prosecution.
Gallagher could not be reached for comment Wednesday night.
Law-enforcement sources described Gallagher as good-natured and well-liked by his colleagues.
He was well-known within the Police Department for having been featured in an old commercial for WOGL Oldies 98, the sources said.
In the commercial, Gallagher was shown in uniform, singing the Supremes' hit, "Stop! In the Name of Love."
Card-counting devices are often the size of small key fobs and designed to resemble, at first glance, the same devices people use to turn off car alarms.
Emerge Innovations, a company that sells the card-counting gadget "Blackjack Pro," said on its website that the device keeps track of the deck and helps players determine the best - and most profitable - time to enter a game by emitting silent vibrations.
The site notes that card counting devices are not legal in every state.