For two weeks, bullets pierced two dozen cars driven through Detroit’s suburbs as police puzzled over who was firing. Unlike most states, Michigan has a tool that helped lead to an arrest: a pistol registry.

Without that database of buyers and sellers, police said, the investigation would have taken longer, more people might have been injured or someone might have been killed, before they arrested an unemployed geologist on Nov. 5 in connection with the crimes.

The story of what worked in Michigan — one of six states that require registration of at least some types of firearms — is also the story of what isn’t happening elsewhere. Gun-rights advocates, led by the National Rifle Association, have successfully campaigned against firearm registries across the United States. Last year, they narrowly lost a bid to eliminate Michigan’s.

“The NRA has been extremely effective at guarding their patrons, the firearms industry, from having to provide data by consistently ginning up a fear that the federal government is going to come for your guns,” said Mark Jones, a former U.S. Bureau of Alcohol, Tobacco, Firearms and Explosives special agent who is a senior law-enforcement adviser at the University of Chicago Crime Lab. “It slows down investigations in a profound way.”

Gun registries are just one area in which the NRA, the nation’s largest pro-gun lobby, has persuaded federal and state lawmakers to block information that might help prevent crimes, solve them or inform policy making. The Fairfax, Va.-based NRA helped persuade Congress to make it tougher to study illegal firearm trafficking, stymie scientific research on shooting deaths and create restrictions that force U.S. law enforcement to record gun sales on microfiche.

The debate over data is intensifying as President Obama seeks new gun-control laws following the Dec. 14 shooting deaths of 20 children and six adults at Sandy Hook Elementary School in Newtown, Conn. The president’s plan calls for using firearms information in new ways, including a proposed law requiring background checks before gun sales and a directive to research causes and prevention of violence.

The NRA, which describes itself as “America’s foremost defender of Second Amendment rights,” opposes both changes. Andrew Arulanandam, a spokesman, didn’t return calls about the group’s efforts to block gun laws and data collection.

The group had 2011 revenue of $219 million, according to its tax returns. From 2004 to 2010, revenue from fundraising, including donations from more than 50 firearms and ammunition companies, grew twice as fast as its income from member dues, according to NRA tax returns. Still, the group says it represents more than 4 million people.

Wayne LaPierre, its chief executive, says Obama is “trying to take away” guns.

“They’ll turn this universal check on the law-abiding into a universal registry of law-abiding people, and law-abiding people don’t want that,” LaPierre said Feb. 2 on “Fox News Sunday.”

Todd Tiahrt, a former Republican congressman from Kansas, said police have the tools to track criminals. Tiahrt successfully pushed NRA-backed measures to block access to data tracing the sale and possession of guns used in crimes, and ban the information from being used as evidence in civil court.

His amendments stopped the ATF from requiring that gun dealers check their inventory for missing weapons and mandated the Federal Bureau of Investigation destroy background check results within 24 hours.

Tiahrt, now chief executive of Neumann Systems, a Colorado Springs, Colo.-based emissions-control provider, said authorities’ best response to the Connecticut massacre would be to investigate the mental-health history of shooter Adam Lanza.

“If they were really concerned about what happened in Newtown, they’d find out what psychiatric drugs this kid was on, how that impacted his view of violence,” he said. “Their motives are questionable at best.”

Since 1979, Congress has prevented ATF from keeping centralized gun-ownership records, according to the agency. Sales data instead are maintained by the country’s 58,900 federally licensed firearms dealers. When they go out of business, they’re required to send the paperwork to ATF, which stores it on microfilm and microfiche.

Without a computer database, ATF traces a gun by contacting the manufacturer to identify the distributor, who will know the dealer. One of those three sources typically will be out of business, forcing ATF to sift through 445 million snapshot images of sales records, said Ginger Colbrun, a spokeswoman.

In 1999, the agency released the results of such traces, showing that Badger Guns & Ammo in West Milwaukee, Wis., sold more firearms used in crimes than any other U.S. dealer. The store promised to change its sales practices.

After the announcement, the number of its guns linked to crimes decreased, according to Daniel Webster, director of the Johns Hopkins Center for Gun Policy and Research in Baltimore. Once the Tiahrt measures took effect in 2003 and the data couldn’t be released publicly, Badger guns linked to crimes increased, according to Webster’s study, published last year in the Journal of Urban Health.

“What the Tiahrt amendments do is provide cover for irresponsible — if not outlaw — dealers,” Webster said.

Milton Beatovic, who said he was an owner of Badger until 2007, declined to comment.

Richard Gardiner, a Fairfax-based lawyer who specializes in firearms cases, said shielding trace data and banning inventory requirements help protect dealers from being harassed by police and reporters.

“That’s how ATF uses most of its regulations,” Gardiner said. “They go after dealers.”

Starting in 1996, the NRA also successfully backed a freeze on U.S. Centers for Disease Control and Prevention funding for research that might have suggested ways to prevent gun killings, said Mark Rosenberg, former head of the CDC’s National Center for Injury Prevention and Control. There were 31,700 gun deaths in 2011, the most recent data available.

The freeze followed the New England Journal of Medicine’s publication of a CDC-funded study that showed guns kept in the home increased the risk of homicide.

In 2011, Congress expanded the research restrictions to the U.S. Health and Human Services Department after lobbying by the NRA. The National Institutes of Health, which falls under the department, funded a study in 2009 that found a person carrying a gun was four-and-a-half times more likely to be shot than an unarmed person.

“The NRA has a zero tolerance for the collection of any data,” said Rosenberg, now president and CEO of the Task Force for Global Health, an Atlanta-based nonprofit that trains public-health professionals.

Chris Cox, executive director of the NRA’s Institute for Legislative Action, said on the group’s website last year that the restrictions “plug yet another hole in the dam holding back anti-gun propaganda.”

“The NRA will watch carefully to see how anti-gun activists working in these agencies respond to the latest thwarting of their agenda,” Cox wrote.

The organization also has successfully argued to block public access to concealed-carry permits, according to the NRA website. At least 27 states now limit the release of such information, according to the Sunshine Review, an Alexandria, Va.-based nonprofit that tracks local government transparency.

Gun registries are banned in eight states, according to the San Francisco-based Law Center to Prevent Gun Violence. The NRA pushed for several of those laws, including Florida’s, which threatens police with a $5 million fine for maintaining a list of legal firearms owners.

In addition to Michigan, states that require some form of gun registration include California, Connecticut, Hawaii, Maryland and New York, according to the NRA’s website. Washington, D.C., does as well.

“Gun registration is the means by which government can ban guns, require you to turn them in or confiscate them,” said Marion Hammer, a former NRA president who lobbies for the group in Florida.

For proof, the NRA points to New York City’s 1991 ban on certain rifles and shotguns. The city used its registration database, created in 1967, to notify more than 2,300 New Yorkers that they must surrender, dismantle or take weapons out of the city, according to an NRA website.

In Michigan, all handgun purchases must be detailed on a “pistol sales record” that shows the buyer, seller and information about the make, model and serial number.

The requirement, instituted by the legislature in 1927, was targeted by the NRA, although legislation to undo it failed in recent years. It gained momentum last year as Republicans took control of the governor’s office, the state House of Representatives and Senate, said Sgt. Chris Hawkins, legislative liaison for Michigan State Police, which oversees the registry.

The bill passed the House and was awaiting Senate action when police arrested geologist Raulie Casteel and charged him with the October driver shootings, Hawkins said.

Hawkins told lawmakers the database helped lead to the suspect. Both Hawkins and Rick Ector, a Detroit firearms instructor who pushed for the bill, said the arrest saved the database.

The registry helped prioritize one of more than 2,000 tips to police, Hawkins said. The information about the shooter’s possible license-plate number showed the car was registered at the same address as a 9 mm Ruger, he said.

Police had already been looking for such a gun because of ballistic evidence, said Clarence Goodlein, public safety director for Wixom, a suburb where most shootings happened.

Police arrested Casteel 20 days after the first shooting. He pleaded not guilty to more than 60 felony charges, including terrorism and assault with intent to murder, both punishable by life in prison, said Douglas Mullkoff, his attorney.

The gun registry may have “meant the difference between someone getting killed by gunfire and someone not,” Hawkins said.

Chris Christoff contributed to this report..