A federal judge dismissed 16 lawsuits from victims of the Emanuel AME Church shooting but blasted the FBI’s background check system.

The families and survivors of the shooting sued the FBI because their background check system missed a drug charge that may have prevented Dylann Roof from purchasing the gun he used during the 2015 massacre. 

U.S. District Judge Richard Gergel dismissed the lawsuit because the Brady Handgun Violence Prevention Act gives the government immunity in some instances where guns may end up in the wrong places. Gergel acknowledged the unfairness of the act saying it applies to “really bad policy choices” too, reports Reuters

The ruling came two days after the third anniversary of the shooting. 

Despite the ruling, Gergel criticized the FBI’s background check system which only used a particular set list of databases during searches.

Roof had a drug charge that might have prevented him from purchasing a gun. A clerk entered the wrong information about his arrest, and that prevented the FBI from catching it, Lexington County Sheriff Jay Koon told The Associated Press. There was a database that had the needed documents, but the FBI did not give examiners access to it.

"The record reveals that the FBI's background check system is disturbingly superficial, excessively micromanaged by rigid standard operating procedures and obstructed by policies that deny the overworked and overburdened examiners access to the most comprehensive law enforcement federal database," Gergel wrote in his order.

"The glaring weaknesses revealed in the background check system, however, are the function of distinct policy choices made by the FBI, not violations of specific legal standards," he added.

Gergel’s order also provided information that survivors and victims' families could use to receive financial compensation via special legislation from Congress, reports The Post and Courier. Gergel used a 1984 bill sponsored by South Carolina Senator Strom Thurmond that resulted in rewards for 16 Charleston Naval Shipyard workers.

Attorney Fred Savage, who represented some of the plaintiffs, said the fight isn’t over, and they’re examining their options.

“What happened was inexcusable, and those that allowed the arming of this hate-filled, mentally deranged, drug-abusing racist must be held accountable,” Savage said. “Our efforts do not stop here.”