The man accused of shooting dead nine black Charleston churchgoers was able to buy a handgun only because of FBI failures.
FBI chief James Comey has admitted the 21-year-old alleged white supremacist should never have been able to get his hands on the .45-calibre weapon used on June 17 to devastating effect in Charleston, but was able to do so because of a breakdown in an FBI background check.
"I'm here today to talk to you about a mistake, in a matter of heartbreaking importance to all of us," Comey told reporters at the FBI headquarters.
"Dylann Roof, the alleged killer of so many innocent people at the Emanuel AME Church, should not have been allowed to purchase the gun he allegedly used that evening."
Comey said a review was under way to prevent a repeat of the blunders and they were in touch with family members of the victims.
Roof was arrested on a drugs charge on March 1 and his admission of guilt for possession would have been sufficient to block a gun sale during an FBI-administered background check.
But a series of missed opportunities and mistakes, including over the geography of where the arrest took place, meant the FBI analyst doing the check did not see the offence.
Consequently, there were no red flags raised within three days, so the gun sale proceeded in April.
Two months later, Roof is said to have shot nine people dead during a Bible study at the South Carolina church - with the same weapon.
"We are all sick that this has happened. We wish we could turn back time because from this vantage point everything seems obvious, but we can't," Comey said.
His admission that the massacre might have been prevented came the same day the divisive Confederate flag came down at South Carolina's legislature, drawing a line under a furore rekindled last month by the mass murder.
Roof, who was indicted on nine counts of murder and is in jail, had been photographed before the attack brandishing firearms and the Confederate flag.