Reynaldo Dagsa, a Manila district councillor, took a photo of his family outside their house on New Year's Day.
Unknowingly, a man raising his gun to fire was included in the background of the snap.The family gave the photo to police who have now detained a man on suspicion of murder.
The killer is shown in the photograph wearing a back-to-front baseball cap just behind Mr Dagsa's daughter, wife and mother-in-law, who were unaware of his presence.
"While he was taking the picture of his family on New Year's Day, the killer appeared and he inadvertently took the picture of the killer with the gun aimed at him," local police chief Jude Santos told the AFP news agency.
Gun violence plagues the Philippines, with cheap firearms easily available on the legal and black markets.