MANILA -- A murdered Philippine politician caught his killer on camera just moments before he was shot dead, with the photograph leading to the arrest of the suspected gunman, police said Tuesday.

The photograph, taken by district councilor Reynaldo Dagsa and distributed by his family to media, shows his relatives posing outside their home while a gunman in the background appears to aim a pistol at the victim.

"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 AFP.

Dagsa, a councilor in a Manila suburb, was shot just moments after clicking the shutter and died while on his way to the hospital, said Santos.

The family gave the photograph to the police, leading to the arrest on Monday of the gunman as well as a suspected accomplice, he said.

The alleged killer is shown in the photograph wearing a reversed baseball cap just behind Dagsa's daughter, wife and mother-in-law, who were apparently unaware of the alleged assailant's presence.

A man who police said was an accomplice to the crime is also seen in the photograph, looking at the gunman about to fire the pistol.

Santos said the suspects had criminal records for robbery and may have had a grudge against the councilor, who was active in law-enforcement activities in his district.

Rampant gun violence has long plagued the impoverished Philippines, with a vast array of cheap firearms easily available on the legal and black markets.