A Texas inmate convicted of murdering a prison guard in 1999 was executed by lethal injection Thursday after the U.S. Supreme Court denied last-minute appeals from his lawyers.

Robert Pruett had been in prison since he was a teenager, after being convicted as an accomplice to a murder committed by his father.

While serving that 99-year sentence, he was convicted of killing prison guard Daniel Nagle in a stabbing attack spurred by a dispute over a peanut butter sandwich. The autopsy showed Nagle died of a heart attack caused by trauma from the assault, according to court documents.

Pruett’s execution in Huntsville marked the sixth this year in Texas and the 20th this year in the United States.

He was found guilty and sentenced to death in 2002 for killing 37-year-old Nagle, who was stabbed eight times with a steel rod sharpened at one end and wrapped in tape at the other, according to court documents.

Prosecutors had argued at Pruett’s trial that he killed Nagle because the prison guard had reprimanded him for taking a sandwich into the recreation yard, which violated prison rules, according to court documents. As evidence of a motive, they showed torn pieces of the prison guard’s disciplinary report, found near Nagle’s body.

No physical evidence connected Pruett to the attack, lawyers argued in court documents. At his trial, Pruett said he was framed and Nagle might have been killed by other inmates or officers, the Associated Press reported.

Moments before being executed, Pruett told friends watching through a window that he loved them, the AP reported. He apologized for hurt he caused others, and said he held no grudges.

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

“I’m ready to go,” Pruett said just before being put to death. “Nighty night. I’m done, warden.”

As he was injected, the AP reported, he began to chant: “Love. Light. It’s forever.”

In a statement released by the criminal justice department, and reported by Reuters, the Nagle family said: “Though it has been over 18 years since he was taken from us, we still miss Daniel every day and the execution will in no way minimize our loss.”

Pruett maintained his innocence and his lawyers petitioned to halt his execution a slew of times. His execution was scheduled for April 2015, but halted by a state judge so additional DNA testing could be conducted on the metal rod used in the stabbing. No new DNA was found on the taped portion of the shank, but a swabbing from the metal rod uncovered DNA from an unknown female. A forensic scientist said the DNA must have come from someone who handled the rod after Pruett’s conviction.

In August, Pruett’s lawyers filed a civil rights lawsuit, arguing that the Texas Court of Criminal Appeals violated his right to due process during DNA proceedings. They asked the court to halt the execution and allow for further DNA testing, but the 5th U.S. Circuit Court of Appeals rejected the lawsuit.

Pruett’s lawyers then filed two separate appeals this week. They once again asked the court to stop Pruett’s imminent death, arguing the U.S. Court of Appeals applied the wrong standard in a decision and asked whether a prisoner who claims actual innocence can be executed.

The court ruled that Pruett’s arguments had no merit, and rejected his lawyers’ attempts to stop the execution. State attorneys called Pruett’s legal efforts “repetitive” and maintained that his defense team contributed to the contamination of the murder weapon.

“Pruett’s challenges to his death sentence have persisted since 1999, and he seeks further unjustifiable delay through his litigation here,” state attorneys said in court documents.

Pruett received a 99-year murder sentence for his role in the 1995 stabbing death of his neighbor, Raymond Yarbrough, east of Houston. Pruett was only 15 years old when the killing took place. Pruett’s father was sentenced to life in prison and his brother was sentenced to 40 years in connection to the death, according to the AP.

Lance Lowry, president of the Texas prison guard union’s Huntsville chapter, told the Texas Tribune that Nagle’s death underscored the issue of understaffing in prisons.

“He died alone . . . he was killed in a room full of inmates,” Lowry told the Texas Tribune. “Unfortunately, I expect to see more Daniel Nagles in the future here, and that scares me.”

The Texas Department of Criminal Justice issued a statement after Pruett’s execution saying he deserved the death penalty, the Texas Tribune reported.

“Pruett . . . was removed from society after being convicted of murder only to kill again within the confines of TDCJ,” the department said. “We hope tonight’s execution provides some closure for [Nagle’s] family.”

The New York Times published a commentary Thursday that argued against executing Pruett, who was 15 when he last saw the outside world and “has never had a chance to live outside a prison as an adult.”

“He is going to be put to death on Thursday because he was failed: first, failed by the father whose actions landed his own son in prison, and then failed by the Texas court system, which senselessly threw a teenager’s life away,” wrote Nathan J. Robinson, an attorney and a PhD student studying criminal justice at Harvard University.

More from Morning Mix: