The man who police say shot and killed 26 people in a Texas church was able to purchase firearms because the Air Force failed to enter his assault conviction into a federal database.

Devin Patrick Kelley was given a bad conduct discharge from the Air Force after he was court-martialed in 2012 for assaulting his wife and fracturing his infant stepson's skull. Kelley's case was enough to prohibit him from possessing a firearm under federal law, but due to a bureaucratic error neither his arrest nor conviction were listed in the national background check database.

Air Force spokeswoman Ann Stefanek confirmed the mistake in a statement.

"Federal law prohibited him from buying or possessing firearms after this conviction," Stefanek said. "Initial information indicates that Kelley’s domestic violence offense was not entered into the National Criminal Information Center database by the Holloman Air Force Base Office of Special Investigations."

Stefanek said the service is now investigating the error.

"Air Force Secretary Heather Wilson and Air Force Chief of Staff Gen. David Goldfein directed a complete review of the Kelley case by the Air Force Office of the Inspector General. The Service will also conduct a comprehensive review of Air Force databases to ensure records in other cases have been reported correctly," she said.

"The Air Force has also requested that the Department of Defense Inspector General review records and procedures across the Department of Defense."

Kelley pleaded guilty to the 2012 assaults and served 12 months' confinement.

He was found dead in his car Sunday several miles from the church massacre with multiple guns in the vehicle.

Kelley fired at the church with a semi-automatic rifle before moving inside and continuing to shoot people. The shooting only stopped when a nearby person opened fire on him with a rifle.oD have been reported correctly.”

Breaking News Editor Kyle Feldscher contributed to this story.