Four years ago, before collecting bullet casings became a widely hailed tool for solving gun crimes, New Jersey state legislators did something radical: They passed a law requiring police to submit guns and casings to a national ballistics database called NIBIN.

Detractors said it would never work — that in the hectic first days of a case, resource-strapped police departments just wouldn’t have the time to get gun evidence to the lab.

They were soon proven wrong. When 19-year-old Brendan Tevlin was shot to death in his car, the police sent the shell casings to the National Integrated Ballistics Information Network, which is administered by the Bureau of Alcohol, Tobacco, Firearms and Explosives. By comparing their markings to those on thousands of other casings in the system, police learned that the gun that shot Tevlin had been used to kill two men outside a Seattle nightclub weeks earlier. Working with Seattle police, they soon arrested a suspect, Ali Muhammad Brown. Brown, who was later convicted, said he had been on a killing spree to protest lives lost in the Middle East because of American foreign policy. Using NIBIN to solve the case quickly may have saved the lives of future victims, police said.

After that, gun evidence started yielding clues regularly. Eighteen months into the new mandate, the New Jersey State Police had increased ballistic leads by 78 percent.

“Today, even if the law was taken off the books, police wouldn’t stop using [NIBIN],” said Lt. Col. Geoffrey Noble, who was in charge of the state crime lab through the transition.

Across the country, police departments and laboratories that use NIBIN efficiently report great results in solving cases. But only one state — Delaware — has followed New Jersey’s lead. No other state requires logging every bullet casing and potential crime gun in NIBIN. With legislatures failing to require the testing, lots of police departments across the country either aren’t using NIBIN, or are using it badly.

Just this summer, a law that would have required policing agencies in California to submit evidence to NIBIN stalled in committee.

Ron Nichols, who once ran NIBIN for the ATF, is unsparing in his criticism of states’ failure to take better advantage of the tool: “It’s reprehensible.”

Jurisdictions that don’t use NIBIN aren’t just denying their residents its crime-solving advantages. Nationally, NIBIN is only as good as the evidence that individual departments put into it.

“If we aren’t sending all guns to the lab, then our murder weapon in San Jose might be sitting on your shelf in Modesto and vice versa,” but neither team would know, Prosecutor Marisa McKeown of the Santa Clara District Attorney’s office, told NBC Bay Area, which has partnered with The Trace to report on NIBIN.

The way police use NIBIN is not so different from the way they use fingerprints. Each time a gun fires a bullet, it leaves a unique marking on the shell casings it ejects. Years ago, police used to take Polaroids of the casings they found at crime scenes. When they thought two crimes might be connected, they laid photos from the two cases next to each other to compare the markings and see if the shooter or shooters had used the same gun.

About 20 years ago, the ATF replaced the old-fashioned snapshots with digital images, and started collecting them in a vast, electronic database. These days, crime labs use desktop computers that look no different from those you’d find in a run-of-the-mill office. Technicians feed in shell casings on electronic trays and the computers take dozens of photos that look like detailed topographical maps. Those images are then uploaded into the national database. Meanwhile, as police officers collect crime guns, they test fire them to generate bullet casings, and run those through the machines.

Experts say if every police department collected as many shell casings as it could and uploaded them all into NIBIN, they could make all kinds of connections that would get shooters off the street. The ATF cites numerous success stories, including one in which New York City police arrested a man for having two illegal pistols. They test fired them, uploaded the casings into NIBIN, and linked the casings to a shooting in Colorado days earlier. Partly on the strength of that evidence, the man pleaded guilty to attempted murder.

If New York detectives hadn’t run the gun through NIBIN, Colorado cops might not have gotten their man — even if they were using the system perfectly.

Still, many municipalities aren’t using NIBIN at all, or they’re using it poorly. An ATF source told NBC Bay Area that only a quarter of all ballistics evidence collected nationwide is entered into NIBIN. In 10 states, state crime labs, which usually serve state prosecutors’ offices and communities that can’t afford their own labs, still do not use NIBIN, according to the ATF. California, Missouri and Arizona are among them. Another 19 states had only one or two NIBIN machines as of 2016, according to The Marshall Project.

Other labs take months or years to enter casings into NIBIN. By the time they get a lead back, it’s likely evidence has dried up. The suspect may have already committed another crime.

New Jersey decided to revamp its ballistics policy in 2013 because gun crimes were skyrocketing in the state. Newark logged 112 murders that year, giving it the third-highest murder rate in the nation. Trenton set a record with 37 murders, while Camden recorded 57.

An earlier directive from the state attorney general had instructed police in New Jersey to submit ballistics evidence promptly. Officials recall that after the new law was signed, officers finally began to do that consistently. Technicians also changed their protocols so they wouldn’t leave evidence on a shelf or in a storage locker, reducing the average time it took New Jersey law enforcement to get evidence into NIBIN from almost a year to two days.

The ATF footed the bill for New Jersey’s NIBIN machines — something it does for a few labs each year. At first, Noble said, implementing the law didn’t create any new costs. Later, as evidence submitted to the state lab increased, state police spent about $300,000 to hire a few additional lab techs. The ATF provided the training — another service the agency offers to all labs using NIBIN. “The change in policy did not require any significant investment,” Noble said.

Delaware decided to follow New Jersey’s lead after its crime problems won Wilmington the dubious nickname “Murder Town USA,” passing its own law in 2016. Since the law went into effect, the number of NIBIN leads increased five-fold, according to a state report.

“Everyone knew that if we got more casings we were going to get more out of the system,” said State Representative Helene Keeley, who introduced the legislation. Like New Jersey, Delaware needed only a few new firearms examiners to implement the change, in their case mostly part-time, state police said. The ATF provided all the equipment and training.

Although some local California labs are using NIBIN with remarkable results, state crime labs don’t use it at all. Its failure to employ the technology statewide means it would take a larger initial investment to get a NIBIN mandate up and running. The California Department of Justice estimated a set-up cost of $12.1 million, followed by annual costs projected to reach $10.1 million.

Some NIBIN experts still think those estimates are unreasonably high. California’s population is about four times bigger than New Jersey’s, but an analysis of the bill by the state Department of Justice found that California would need more than 10 times as many technicians as New Jersey.

California is often seen as a leader in implementing smart gun laws. This year the Legislature sent nine new gun control bills to the governor for his signature. To Nichols, the former ATF official, the state’s failure to pass the NIBIN law is a conspicuous exception.

They’re only looking at gun control when they should be looking at shooter control,” he said, adding that if police can catch the small number of people pulling the triggers, they can greatly reduce overall crime.

State Representative Evan Low, the sponsor of the bill, said he plans to resubmit it next year.

“Solving crimes and putting criminals in jail is an obligation of utmost importance to the state,” Low said. “This is a statement of values.”