LITTLE ROCK, Ark. (AP) — A former Arkansas death row inmate whose conviction was overturned because one juror slept and another tweeted during court proceedings avoided the death penalty Friday by pleading guilty to capital murder.

Erickson Dimas-Martinez, 27, was sentenced to spend the rest of his life in prison without parole as part of a plea deal with prosecutors.

He admitted to robbing and killing 17-year-old Derrick Jefferson and apologized for what he had done, his attorney and a prosecutor said. He also received another life sentence for an aggravated robbery charge during his court appearance in Bentonville.

Dimas-Martinez was previously convicted and sentenced to death for killing Jefferson in northwest Arkansas in 2006, but the state Supreme Court overturned his 2010 conviction last year. The high court ruled that a juror who tweeted during court proceedings violated general instructions not to discuss the case.

“Most mobile phones now allow instant access to a myriad of information,” Justice Donald Corbin wrote for the court last year. “Not only can jurors access Facebook, Twitter or other social media sites, but they can also access news sites that might have information about a case.”

Dimas-Martinez’s case raised questions about social media and jury trials, and the state Supreme Court asked a panel to consider whether to limit jurors’ access to cellphones during trials. No decision has been made so far, but the issue almost certainly would have come up if Dimas-Martinez had gone to trial next month as scheduled.

Prosecutor Van Stone said he was pleased with the plea deal, which spared Jefferson’s family from having to endure another trial and round of appeals.

“He’ll die in prison and that’s not insignificant,” Stone said Friday.

One of Dimas-Martinez’s lawyers, Tony Pirani, said Dimas-Martinez told the court that he would take his actions back if he could.

“Erickson for quite some time now has wanted nothing more to let the family know how sorry he is,” Pirani said.

Jefferson’s family wasn’t able to make it to court Friday, but the prosecutor said this was the outcome they wanted.

Dimas-Martinez’s guilty plea comes a day after he spoke and prayed with his family in El Salvador, Pirani said.

“It’s one thing to get that as a sentence, but to sign up for it is not an easy thing to do,” Pirani said.