Convicted South Carolina church shooter Dylann Roof is set to plead guilty to state murder charges, avoiding a second death sentence and effectively bringing to a close the prosecutions against him for the 2015 slaughter.

Solicitor Scarlett Wilson told The Associated Press on Friday that Roof is scheduled to enter a guilty plea during a hearing on April 10 in Charleston.

The plea on all of his state charges, including nine counts of murder, comes in exchange for a sentence of life in prison, the prosecutor said.

Roof, 22, has been awaiting trial on state murder charges for the deaths of nine black parishioners at Charleston's Emanuel AME Church in June 2015.

Authorities said Roof spent months planning out his attack on the historic black church, sitting through an hour of Bible study one Wednesday night before opening fire during a closing prayer, while participants' eyes were closed.

The deal won't save Roof from a possible execution. Earlier this year, a federal jury sentenced him to death on charges including hate crimes.

The plea marks the end of the trial proceedings against Roof, who has been in custody ever since his arrest the day after the shootings. Aside from trips to and from court, he's been housed in the Charleston County jail, several miles north of the city where the slayings took place.

After his federal sentencing, Roof was returned to that jail instead of federal death row in Terre Haute, Indiana, since his state trial was expected to come this year. Now, if this deal goes through, he'll be able to be transferred to serve his sentence.

Wilson also had sought the death penalty in state court. Talking with AP on Friday, she said she was confident the federal case against Roof would be upheld.

"I think it is highly unlikely that anything will be disturbed on appeal in federal court," she said. "This just gives an insurance policy against that."