LEXINGTON, S.C. -- A jail clerk made a mistake when entering information about a drug arrest for South Carolina church shooting suspect Dylann Roof, the first in a series of missteps that allowed Roof to purchase a gun he shouldn't have been able to buy two months before the attack, authorities said.

Lexington County Sheriff Jay Koon told The Associated Press in a statement that the jail discovered mistakes two days after Roof's arrest, but the change wasn't corrected in the state police database of arrests. So when a FBI examiner pulled Roof's records in April, she called the wrong agency, and Roof was eventually allowed to buy the .45-calibre handgun that would be used in the June 17 shooting at Emanuel African Methodist Episcopal Church in Charleston, authorities said.

FBI Director James Comey on Friday promised a full review when he said Roof should have never been allowed to buy the gun. The sheriff on Monday also promised he was making changes that would flag discrepancies like the one that appeared to let Roof slip through the cracks.

The FBI allows a gun sale if it can't give a definitive answer about whether someone can buy the gun after three days, which is what happened in Roof's case. The FBI examiner knew Roof had an arrest record, but couldn't find the documents.

In 2014, the FBI reported about 2 per cent of background checks end with the FBI not getting enough information and failing to give an answer. Officials said they do about 58,000 checks on a typical day.

There were a couple of mistakes that ended up in the criminal records database. State police records of Roof's drug arrest pulled by AP after he was identified as the church shooting suspect had the drug charge listed as a felony with the arresting agency as Lexington County Sheriff's Office. They have since been corrected. The charge is a misdemeanour and the arresting agency was the Columbia police department.

Koon, the sheriff, said that when the FBI examiner called his deputies, they pointed out the arrest was by Columbia Police. But the woman doing the FBI background check checked a spreadsheet of law enforcement agencies in Lexington County and it did not include Columbia because it is mostly in neighbouring Richland County. The examiner called the police department in West Columbia -- where the gun was bought -- and found nothing.

Only a very small part of Columbia is in Lexington County, but the city's jurisdiction includes the entire Columbiana Centre mall where Roof was arrested. A police officer at the mall took Roof into custody after he asked several employees what time their stores closed, how many people were working and when they left. The officer searched Roof and found a drug doctors use to treat narcotic addiction without a prescription, according to a police report.

That information should have been enough to prevent Roof from buying a gun based on a federal law banning gun sales to anyone who uses or is addicted to a controlled substance, Comey said.

The FBI examiner also said it sent a fax to prosecutors in Lexington County looking for more information about the arrest and the fax was never answered.

A secretary said chief prosecutor Donnie Myers was in court in Saluda County on Monday. He didn't return a phone message.

Roof still faces the drug charge, along with a trespassing charge he received when he returned to the mall a few months later after he was banned, authorities said. He is charged with nine counts of murder, three counts of attempted murder and a weapons charge in the shooting at the historic African-American church. Authorities said Roof, who is white, targeted the churchgoers because they were black.