A lawsuit over a faulty background check that allowed a South Carolina man to buy the gun he used to kill nine people at AME Emanuel Church in Charleston was reinstated Friday by a federal appeals court. The three-judge panel reversed a ruling from a lower court judge who threw out the claims brought by relatives of people killed by Dylann Roof in the 2015 massacre and by survivors.

The 4th Circuit panel found that an examiner who conducted the background check on Roof failed to follow a mandatory procedure when she did not contact the arresting agency.

The ruling means the lawsuit can move forward.

Get Breaking News Delivered to Your Inbox

The FBI acknowledged that Roof's drug possession arrest in Columbia, South Carolina — weeks before the shooting — should have prevented him from buying a gun. Roof has been sentenced to death for the slayings.

A series of clerical errors and missteps allowed Roof to buy the handgun he later used in the massacre.

In his ruling last year, U.S. District Judge Richard Gergel said a jail clerk wrongly listed the Lexington County Sheriff's Office as the arresting agency in the drug case. The examiner then sent a fax to the sheriff's office, which responded that it did not have the arrest report and directed her to Columbia police.

Gergel said that under the system's operating procedures, the examiner was directed to a federal listing of law enforcement agencies, but Columbia police did not appear on the list. After trying the separate West Columbia Police Department and being told it was the wrong agency, the examiner did nothing more.

After a three-day waiting period, Roof went back to a West Columbia store to pick up the handgun.

A spokeswoman for the U.S. Department of Justice declined to comment on the ruling.