The slain officer, Detective Joseph Seals, 40, was credited by his superiors with having led the department in the number of illegal guns removed from the streets in recent years, and might have been trying to stop an incident involving such weapons when he was cut down by gunfire that erupted near a cemetery, authorities said.