WASHINGTON — The FBI’s background-check system is missing millions of records of criminal convictions, mental illness diagnoses, and other flags that would keep guns away from potentially dangerous people.
The gap contributed to the shooting deaths of 26 people in a Texas church last week.
Analysts who study the data say government agencies responsible for maintaining such records have long failed to forward them into federal databases used for gun background checks. The systemic breakdowns have lingered for decades as officials decided they were too costly and time-consuming to fix.
As the shooting at a Texas church on Sunday showed, what the FBI doesn’t know can get people killed. In that case, the gunman had been convicted at a court-martial of charges stemming from a domestic violence case.
Officials say the Air Force never notified the FBI of his conviction, so when he purchased weapons at a retail store, he cleared the background check.
The FBI said it doesn’t know the scope of the problem, but the National Rifle Association says about 7 million records are absent from the system, based on a 2013 report by the nonprofit National Consortium for Justice Information and Statistics.
That report determined that ‘‘at least 25 percent of felony convictions . . . are not available’’ to the National Instant Criminal Background Check System maintained by the FBI.
Experts who study the data say that estimate can be misleading, because felons often have multiple convictions, so if one is missed, others may still alert authorities to individuals who cannot legally buy a gun.
The government funded a four-year effort beginning in 2008 to estimate how many records existed of people who should be barred under US law from buying a gun but aren’t flagged in the FBI system. That effort was abandoned in 2012 because of the cost.
The National Rifle Association has complained that the federal database is inadequate. The gun rights lobbying group opposes calls for more restrictions on gun buying, arguing that the government should focus instead on making its current background-check system fully functional.
‘‘The shortcomings of the system have been identified, there just seems to be a lack of will to address them,’’ said Louis Dekmar, president of the International Association of Chiefs of Police.
Air Force officials have launched an internal review and faulted the staff at an air base for not sending the necessary information to the FBI, but federal officials say the problem is much more widespread.