PHILADELPHIA — In a series of brazen attacks a few summers back, a man known as the “ruthless robber” stole money from his victims and then opened fire on them, leaving little behind but wounded bodies and ejected shell casings.

The police did not know when the emboldened man might strike again. But a week after the fourth robbery, a 9 millimeter Glock handgun discovered during an unrelated traffic stop was matched to the spent bullets through a federal ballistics database, leading detectives straight to Amin Ackridge.

“This case would likely have gone unsolved” if not for the bullet match, said Jason Grenell, an assistant district attorney in Philadelphia. He successfully prosecuted Mr. Ackridge last year for the 2015 robberies and shootings, which injured four people, including a man who tried to intervene and is now paralyzed from the waist down. Mr. Ackridge was sentenced to 178 years in prison.

Across the country, police departments are increasingly turning to the National Integrated Ballistic Information Network, and its catalog of more than three million detailed images of spent shell casings, to connect dots and solve investigations that might otherwise have stalled. Overseen by the Bureau of Alcohol, Tobacco, Firearms and Explosives, the database, also known as NIBIN, can identify whether the same gun was used in multiple shootings.