A Texas inmate convicted in the death of a prison guard was executed Thursday after the U.S. Supreme Court rejected his lawyers' attempts to halt the punishment.

Robert Pruett was given a lethal injection for the fatal attack on corrections officer Daniel Nagle in December 1999 at a prison southeast of San Antonio.

Nagle was repeatedly stabbed with a tape-wrapped metal rod, though an autopsy showed he died from a heart attack that the assault caused.

Prosecutors have said the stabbing stemmed from a dispute over a peanut butter sandwich that Pruett wanted to take into a recreation yard against prison rules.

In his final statement before being put to death, the 38-year-old Pruett said he hurt a lot of people and a lot of people hurt him. He said he was sorry and held no grudges.

This undated file photo provided by the Texas Department of Criminal Justice shows Robert Pruett who was executed on Thursday for the death of a corrections officer

'I've had to learn lessons in life the hard way,' he said. 'One day there won't be a need to hurt people.'

He told his friends who were watching the execution through a window that he loved them. 'I'm ready to go,' Pruett said. 'Nighty night, everybody. I'm done, warden.'

As the lethal dose of the powerful sedative pentobarbital began to flow, he started to chant: 'Love. Light. It's forever.'

His voice rose as he repeated the phrase. He added obscenities and soon was yelling.

He started to slur his words before slipping into unconsciousness. He was pronounced dead at 6:46 p.m. CDT, 29 minutes after being given the drug.

Pruett, who was already serving a 99-year sentence for a neighbor's killing near Houston when he was convicted in Nagle's death, lost two appeals at the Supreme Court as his execution neared.

He became the 20th prisoner put to death this year in the U.S. and the sixth in Texas, which carries out the death penalty more than any other state. Texas executed seven inmates last year.

About 100 corrections officers stood in formation outside the Huntsville Unit prison as Pruett was being executed. They remained there as Nagle's relatives emerged from the prison after witnessing the punishment.

'While some people may not understand this, I forgive him because God's word tells us to do so,' Nagle's wife, Crystal, said. 'Now it's up to God, because Jesus is the one who does the final judgment.'

Pruett's lawyers had asked the high court to review whether lower courts properly denied a federal civil rights lawsuit that sought additional DNA testing in his case.

They also questioned whether a prisoner like Pruett, who claimed actual innocence in federal court because of newly discovered evidence after exhausting all other appeals, could be put to death.

Pruett avoided execution in April 2015, hours before he could have been taken to the death chamber, when a state judge halted his punishment so additional DNA testing could be conducted on the rod used to stab the 37-year-old Nagle.

The new tests showed no DNA on the tape but uncovered DNA on the rod from an unknown female who authorities said likely handled the shank during the appeals process after the original tests in 2002.

Pruett's attorneys unsuccessfully sought more DNA testing and filed a federal civil rights lawsuit arguing Pruett had been denied due process. The 5th U.S. Circuit Court of Appeals rejected the lawsuit last week, and the lawyers appealed to the Supreme Court on Tuesday.

Attorneys for Texas told the Supreme Court that Pruett's appeals were delay tactics after issues were 'repeatedly raised' and 'properly rejected' by the courts.

No physical evidence tied Pruett to Nagle's death at the Texas Department of Criminal Justice's McConnell Unit near Beeville.

At his 2002 trial, prisoners testified that they saw Pruett attack Nagle or heard him talk about wanting to kill the guard. According to some of the testimony, he talked about possessing a weapon as well.

Pruett had said he was framed and that Nagle could have been killed by other inmates or corrupt officers at the McConnell Unit.

Pruett's 99-year murder sentence was for participating with his father and a brother in the 1995 stabbing death of a 29-year-old neighbor, Raymond Yarbrough, at the man's trailer home in Channelview, just east of Houston. Pruett was 15 when the attack happened.

According to court testimony from a sheriff's detective, Pruett argued with Yarbrough and then got his father and brother to join him in attacking the man. Pruett punched and kicked Yarbrough and held him down while his father stabbed the man multiple times, the detective said.

Pruett's father, Howard Pruett, is serving life in prison. His brother, Howard Pruett Jr., was sentenced to 40 years