CHARLESTON, S.C. — Convicted Charleston church shooter Dylann Roof was given nine consecutive life sentences in state prison after he pleaded guilty to state murder charges Monday, leaving him to await execution in a federal prison and sparing his victims and their families the burden of a second trial.

Judge J.C. Nicholson imposed the sentences following a hearing in which church members and Roof's grandfather testified about the personal toll of the case.

Standing at the defense table with his attorneys, clad in a gray and white striped jail jumpsuit and handcuffed to a chain at his waist, the self-avowed white supremacist entered his guilty pleas.

Under a plea agreement, Judge J.C. Nicholson sentenced Roof to life in prison on the state murder charges. The deal with state prosecutors, who also had been pursuing the death penalty, comes in exchange for a life prison sentence on the state charges.

But before sentencing Roof, Nicholson heard members of historically black Emanuel AME Church describe the toll the shooting took on them and their community.

"The impact at Mother Emanuel has been far reaching," said Pastor Eric Manning, who currently leads Emanuel's congregation. "We visit the crime scene every day."

Blondelle Gadsden, sister of slain Myra Thompson, said, "Even though we're at a point where death has been the sentence for him, my heart still goes out to him in hopes that he would repent to save himself from himself. I can't think of anything worse that he could do at this point than to not accept Christ and try to make his days on this earth a little bit more peaceful."

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

But Eva Dilligard, whose sister Susie Jackson was slain by Roof, said, "I think somebody doing something like that, he should get death. ... I'm very sorry. I'm a child of God. But he hurt the entire family."

The judge also heard from Roof's grandfather, Columbia attorney Joe Roof.

"I want everyone to understand that nothing is all bad, and Dylann is not all bad," the elder Roof said. He added that he and his wife pray for the Emanuel families every night, and are sensitive to their problems.

"We have been distressed and just sick over what has happened to these families," the grandfather said.

Dylann Roof had been unapologetic at his federal trial as he listened to days of testimony from survivors. They described in harrowing detail the hail of bullets that began when parishioners closed their eyes to pray during a June 2015 Bible study at the church known as Mother Emanuel.

After Monday's hearing, Roof, 23, will return to a local jail, while technically in the custody of the U.S. Marshals Service, until he's transferred to a Bureau of Prisons facility "in short order," a law enforcement official with knowledge of the case told The Associated Press.

The official spoke on a condition of anonymity because he wasn't authorized to speak publicly about the case.

Roof will be taken to a federal prison in another state, where he will await his execution on charges of hate crimes and obstruction of the practice of religion.

Roof was convicted late last year of 33 federal charges. He was sentenced to death during a separate proceeding earlier this year. Relatives of each of the nine people killed attended court each day of his federal trial. Some testified with emotion about the voids left by the losses of their loved ones.

Survivors of the shooting also spoke in court during the federal trial, evoking chilling images of the bloody Wednesday night tableau. Jennifer Pinckney, the widow of slain pastor and state Sen. Clementa Pinckney, brought some jurors to tears with her description of how she shielded her young daughter in her husband's office as the bullets rang out in the nearby fellowship hall.

During his federal trial, Roof was placid and, at times, unapologetic. Twice found competent to stand trial, Roof fired his defense team for the sentencing portion of his proceedings, calling no witnesses or putting up any evidence of his own.

"I have the right to ask you to give me a life sentence, but I'm not sure what good it would do anyway," Roof told jurors in his closing argument. "I still feel like I had to do it."

Through their attorneys, some relatives and survivors spoke out when the state plea arrangement was announced by prosecutors last month. Charleston attorney Andy Savage, who represents several of the families, said the arrangement to transfer Roof to a federal institution and away from Charleston "is the preference of all victims that I represent."

Savage said Felicia Sanders, who watched as both her son and her aunt died in the shootings, summed up her feelings in two words: "Praise God."

Manning told the judge on Monday that the church's resiliency "will continue to inspire not only the church members ... but we would pray the entire state, country and world. For surely love is always stronger than hate, and hate will never win.