HOUSTON (AP) — A Texas death row inmate whose case clarified the role of spiritual advisers in death chambers nationwide is scheduled for execution Wednesday, despite efforts by a district attorney to stop his lethal injection.

John Henry Ramirez, 38, was sentenced to death for killing 46-year-old Pablo Castro, a convenience store clerk, in 2004. Prosecutors said Castro was taking the trash out from the store in Corpus Christi when Ramirez robbed him of $1.25 and stabbed him 29 times.

Castro’s killing took place during a series of robberies; Ramirez and two women had been stealing money following a three-day drug binge. Ramirez fled to Mexico but was arrested 3½ years later.

Ramirez challenged state prison rules that prevented his pastor from touching him and praying aloud during his execution, saying his religious freedom was being violated. That challenge led to his execution being delayed as well as the executions of others.

In March, the U.S. Supreme Court sided with Ramirez, saying states must accommodate the wishes of death row inmates who want to have their faith leaders pray and touch them during their executions.

On Monday, the Texas Board of Pardons and Paroles unanimously declined to commute Ramirez’s death sentence to a lesser penalty. According to his attorney, Ramirez has exhausted all possible appeals and no final request to the U.S. Supreme Court is planned.

The lead prosecutor at Ramirez’s trial in 2008, Mark Skurka, said it was unfair that Ramirez would have someone praying over him as he dies when Castro didn’t have the same opportunity.

“It has been a long time coming, but Pablo Castro will probably finally get the justice that his family has sought for so long, despite the legal delays,” said Skurka, who later served as Nueces County district attorney before retiring.

Ramirez’s attorney, Seth Kretzer, said while he feels empathy for Castro’s family, his client’s challenge was about protecting religious freedoms for all. Ramirez was not asking for something new but something that has been part of jurisprudence throughout history, Kretzer said. He said even Nazi war criminals were provided ministers before their executions after World War II.

“That was not a reflection on some favor we were doing for the Nazis,” Kretzer said. “Providing religious administration at the time of death is a reflection of the relative moral strength of the captors.”

Kretzer said Ramirez’s spiritual adviser, Dana Moore, will also be able to hold a Bible in the death chamber, which hadn’t been allowed before.

Ramirez’s case took another turn in April when current Nueces County District Attorney Mark Gonzalez asked a judge to withdraw the death warrant and delay the execution, saying it had been requested by mistake. Gonzalez said he considers the death penalty “unethical.”

During a nearly 20-minute Facebook live video, Gonzalez said he believes the death penalty is one of the “many things wrong with our justice system.” Gonzalez said he would not seek the death penalty while he remains in office.

He did not return a phone call or email seeking comment.

Also in April, four of Castro’s children filed a motion asking that Ramirez’s execution order be left in place.

“I want my father to finally have his justice as well as the peace to finally move on with my life and let this nightmare be over,” Fernando Castro, one of his sons, said in the motion.

In June, a judge declined Gonzalez’ request to withdraw Wednesday’s execution date. Last month, the Texas Court of Criminal Appeals declined to even consider the request.

If Ramirez is executed, he would be the third inmate put to death this year in Texas and the 11th in the U.S.