RICHMOND, Va. (AP) – A federal appeals court has reinstated a lawsuit over a faulty background check that allowed Dylann Roof to buy the gun he used to kill nine people in a racist attack at a South Carolina church.

A three-judge panel of the 4th U.S. Circuit Court of Appeals on Friday reversed a ruling from a lower court judge who threw out the claims. The claims were brought by relatives of people killed in the 2015 massacre at Charleston’s AME Emanuel Church, and by survivors.

The lower court judge found that the government was immune from liability. The appeals court disagreed.

The FBI has acknowledged that Roof’s drug possession arrest weeks before the shooting should have prevented him from buying a gun.

Roof has been sentenced to death in the massacre.