Dylann Roof arrest
Police with accused mass killer Dylann Roof following the fatal shooting of 9 black parishioners at a Charleston church.Shelby Police Department

The self-proclaimed white supremacist who has been charged with the hate-crime murder of nine black parishioners at an African American church in South Carolina has been attacked in jail.

Dylann Roof, 22, was assaulted by a black fellow inmate Dwayne Stafford, who managed to get out of his cell and run down a set of stairs to attack Roof outside the showers at the South Carolina Detention Center, said police.

Roof is in protective custody in the jail but Stafford managed to attack him when the only guard present was distracted getting another inmate toilet paper, CNN reported. Stafford punched Roof several times in the face and body, and Roof suffered bruising to his face and back, according to a police report.

"The detention officer responded quickly and separated the two," said Charleston County Sheriff Al Cannon Jr. "The injuries that Roof received are relatively minor — some bruising around the face and the back. It appears he was struck with a fist and nothing more serious than that."

But he said the attack was a "wake up call" that guards have to be more vigilant. "We do things day in and day out and they become routine and as a result of that [officers] become complacent," Cannon said.

Roof was examined by jail medical personnel and returned to his cell. Roof doesn't plan to press charges.

Stafford, 26, is serving time for robbery and assaulting a police officer.

Dwayne Stafford
Dwayne Stafford who attacked Dylann Roof at the Charleston County Detention Center.Photo courtesy Charleston County Sheriff's Department

Officials are investigating how Stafford managed to get through a cell door to reach Roof. The assault was the first violent incident involving the alleged gunman, said police.

Several Tweets hailing Stafford surfaced after news of his attack on Roof.

Roof faces the death penalty if convicted in the fatal shooting of nine people, including Reverend Clementa Pinckney during a Bible study session at the Emanuel African Methodist Episcopal Church — one of America's oldest black churches — in Charleston, South Carolina, in June 2015.

Roof sat quietly in a bible study group in the church before he opened fire, targeting victims because they were black, prosecutors charge. He hesitated at first because "everyone was so nice," he would later say, but then he announced he was there to "shoot black people," said investigators.

He has been charged with 33 federal offences, including hate-crimes.

Roof's "lack of remorse," his "animosity towards African Americans" that played a role in the murders and his intent to "magnify the societal impact" of the rampage all led to the decision by the US Justice Department to pursue the death penalty, according to a court document filed in the federal case against Roof.

His lawyers just filed a legal challenge to capital punishment, saying it was "arbitrary and cruel" and therefore unconstitutional. They said Roof would drop the challenge if federal prosecutors abandon their decision to seek the death penalty and allow him to plead guilty and receive a sentence of life without parole.

Roof's first trial is scheduled to begin January 2017.