A Texas death row inmate whose case redefined the role of spiritual advisers in death chambers nationwide was executed Wednesday, despite the efforts of a district attorney to stop his lethal injection.

John Henry Ramirez, 38, was executed at the state penitentiary in Huntsville. He was convicted of killing 46-year-old Pablo Castro in 2004, as he took out the trash while working at a convenience store in Corpus Christi.

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.

In the execution chamber, his spiritual adviser, Dana Moore, placed his right hand on the inmate’s chest, and held it there for the duration. With his back to witnesses, Moore offered a brief prayer.

john henry ramirez texas police department

This undated photo provided by The Texas Department of Criminal Justice shows John Henry Ramirez. (Texas Department of Criminal Justice via AP, File)

TEXAS POLICE DEPARTMENT TAKES A CAR-SALESMAN APPROACH IN VIRAL RECRUITMENT VIDEO

"Look upon John with your grace," he prayed. "Grant him peace. Grant all of us peace." As Moore’s prayer ended, Ramirez responded: "Amen."

After the prayer, Ramirez addressed five of Castro’s relatives – including four of his children – as they watched through a window a few feet from him. "I have regret and remorse," he said." This is such a heinous act. I hope this finds you comfort. If this helps you, then I am glad.

"I hope in some shape or form this helps you find closure."

Ramirez expressed love to his wife, son and friends, concluding with: "Just know that I fought a good fight, and I am ready to go."

POLICE ADVOCATE REJECTS AUSTIN MYAOR'S APOLOGY FOR DOZING OFF AT OFFICER'S FUNERAL: ‘IT’S DISGUSTING'

As the lethal dose of pentobarbital took effect, he took several short breaths then began snoring. Within a minute, all movement stopped. Ramirez was pronounced dead 14 minutes later, at 6:41 p.m. CDT.

Prosecutors said Ramirez robbed Castro of $1.25 then stabbed him 29 times. Castro’s killing took place during a series of robberies conducted by Ramirez and two women 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.

CLICK HERE TO GET THE FOX NEWS APP

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 had exhausted all possible appeals and no final request to halt the execution was filed with the U.S. Supreme Court.

The lead prosecutor at Ramirez’s trial in 2008, Mark Skurka, said it was unfair that Ramirez had someone praying over him as he died 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.