The Chicago Police Department and federal agents in Chicago are using advanced ballistics tests to try to link recovered guns to unsolved crimes — and sometimes seek tougher penalties for people caught with illegal weapons.

This year, police have recovered thousands of guns, most of which are tested to link them to other crimes. The tests have resulted in more than 50 open investigations into crimes since last year, said Tom Ahern, a spokesman for the U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives, which works with the police on gun cases.

“It’s a new approach to identifying the most violent offenders out there,” Ahern said.

He said investigators are focusing on four of Chicago’s most dangerous police districts — South Chicago and Englewood on the South Side and Austin and Harrison on the West Side. Those districts have driven much of the rise in violence that’s seen 616 murders in Chicago as of the end of October — the most in a single year since the 1990s — and 3,657 shooting victims.

Through the end of October, police have recovered 7,224 guns — up 21 percent over the same period last year — with more than 3,300 of those resulting in an arrest.

The guns are tested through ATF’s National Integrated Ballistic Information Network, known as NIBIN. Firearms examiners enter cartridge casings into the system, and they’re compared with a database of cartridges recovered from crime scenes.

When there’s a match, detectives investigate whether the person caught with the illegal gun was a suspect in the crime linked to the weapon or sold the gun to someone else who committed the crime.

In one of these cases, Kevin Chester, 26, was charged with carrying a loaded .38-caliber Taurus revolver on April 12, 2014. He tossed the gun while running from two officers who said they spotted it in his waistband.

Chester, a member of the Gangster Disciples’ Goon Squad faction, told officers rival gangs were “rolling by, shooting. That’s why I have it,” according to federal prosecutors.

Kevin Chester

Kevin Chester

Chester pleaded guilty to possession of a firearm by a felon. Prosecutors asked for a 10-year sentence, the maximum.

“The seriousness of the offense is best demonstrated by picking up a Chicago newspaper and reading the headlines,” prosecutors wrote in their sentencing memo. “Every day, it is the same thing. Multiple people shot. Multiple people killed. Most often the shooters and the victims are people just like Chester.”

Prosecutors noted Chester was previously convicted of two robberies and said he’d been linked to a murder in which he hasn’t been charged. According to Ahern, police recovered a gun while searching a home in Chicago, a witness said he got the gun from Chester, and a NIBIN test linked it to a killing. Ahern said another witness told police Chester was at the scene of that still-unsolved killing.

Chester’s attorney, Rose Lindsay-Guimaraes, asked Judge Sara Ellis not to consider the NIBIN evidence at sentencing, saying it was unrelated to the gun-possession case. Ellis agreed but still sentenced Chester on Tuesday to nine years in prison based on his violent past.

Federal prosecutors also used NIBIN evidence against 26-year-old Demond Coffee, who’s charged with possession of a firearm by a felon. They say Coffee was running from police last year, pulled a loaded Glock 9mm pistol from his waistband and tossed it into a vacant lot.

“The gun . . . isn’t just dangerous because it was illegally possessed by someone who has no permission, but the gun has been linked with a high degree of confidence by law enforcement to two other shootings that happened in Chicago,” Assistant U.S. Attorney Devlin Su told Judge Jeffrey Cole in March during a bail hearing.

Demond Coffee

Demond Coffee

A NIBIN test showed the gun — stolen in April 2015 in Indianapolis — was used in the killing of 7-year-old Amari Brown on the Fourth of July in 2015 and also was used to shoot and wound a 15-year-old boy on Aug. 8, 2015. Coffee was arrested with the gun on Aug. 17, 2015, prosecutors said.

Coffee, an admitted Four Corner Hustlers gang member, hasn’t been implicated in either shooting. Two other men — Rasheed Martin, 21, and Jamal Joiner, 22, also members of the Four Corner Hustlers, according to prosecutors — have been charged with murder in Amari’s death in Humboldt Park. No one’s been charged in the other shooting.

In March, Cole ordered Coffee held without bail. In May, Coffee’s new attorney, Beau Brindley, again petitioned the court to free his client on bail, arguing the NIBIN link to the shootings has nothing to do with Coffee’s gun-possession case.

“What someone else may have done with a firearm in the past is not a basis to detain Mr. Coffee now,” Brindley wrote.

But Judge Elaine Bucklo denied bail, and Coffee remains in jail awaiting trial Dec. 12.