Just hours before Texas was to execute Robert James Campbell, a convicted murderer, a federal appeals court halted the execution because of what Campbell’s attorneys called his “intellectual disability.”

Campbell was scheduled to die by lethal injection in Huntsville, Tex. He would have been the 21st person executed in the United States this year, and the eighth in Texas. He also would have been the first since a botched execution in Oklahoma two weeks ago drew renewed attention to the use of the death penalty.

Campbell was sentenced to death in 1992 for murdering Alexandra Rendon, a 20-year-old bank teller, the previous year. Rendon was abducted by Campbell and an accomplice while getting gas and was robbed and raped before Campbell fatally shot her.

Attorneys for Campbell, 41, had argued that he is intellectually disabled and therefore should not be put to death. The Supreme Court ruled in 2002 that executing the mentally disabled violates the Constitution’s prohibition against cruel and unusual punishment.

Campbell’s attorneys had said that the state did not disclose multiple I.Q. tests proving the disability, including a score of 68 when Campbell was a child and a score of 71 after he arrived on death row.

This photo provided by the Texas Department of Criminal Justice shows Robert Campbell. (AP)

State officials had lied when they said there were no records of I.Q. tests during Campbell’s time on death row, said Robert C. Owen, an attorney for Campbell.

“They had such test results, and those results placed Mr. Campbell squarely in the range for a diagnosis of mental retardation,” Owen said.

The U.S. Court of Appeals for the 5th Circuit in New Orleans ruled Tuesday afternoon that the execution be stayed, saying that although it was regrettable that it took until “the eleventh hour” for the court to review evidence of the inmate’s intellectual disability, that was not the fault of Campbell or his attorneys.

“Because of the unique circumstances of this case, Campbell and his attorneys have not had a fair opportunity to develop Campbell’s claim of ineligibility for the death penalty,” Judge James L. Dennis wrote for the court. “In light of the evidence we have been shown, we believe that Campbell must be given such an opportunity.”

It’s unclear how long the execution will be stayed. There is no set time for the stay, said Jason Clark, a spokesman for the Texas Department of Criminal Justice.

In a statement, Owen called the court’s decision “an opportunity for Texas to rise above its past mistakes.”

Meanwhile, inside and outside the penitentiary in Huntsville, reactions came swiftly from the inmate who was spared, his relatives and the family of his victim.

“I’m happy,” Campbell said after his execution was called off, according to a Texas prisons spokesman. “The Lord prevailed.”

The stay came so late in the process that members of Rendon’s family were gathered for an orientation meeting preparing them for the execution when they were told that it would not take place.

“It’s heartbreaking, heart-sinking,” Israel Santana, Rendon’s cousin, said in a telephone interview. “My entire family is just physically and emotionally drained. It’s really rough.”

Santana said he has faith that the execution will happen at some point.

“It’s heart-sinking that everybody’s worried about what they say is a cruel and unusual sentence for Robert Campbell, but they’re forgetting why they’re even here, what started this whole thing,” Santana said.

Meanwhile, the stay provided relief for Campbell’s relatives. Moments after the news emerged, his sister pulled into a parking lot across the street from the penitentiary, jumping out of the car and laughing with several friends. She said that her brother had maintained a positive attitude right up until the news of the stay.

“We were worried, but we had faith,” she said. “Matter of fact, Robert had more faith than we did.”

In addition to arguing that Campbell has a mental disability, his attorneys also filed an appeal with the U.S. Supreme Court criticizing the secrecy surrounding the drugs that would be used in the execution. This argument was particularly fraught, coming in the wake of the botched execution last month of Oklahoma inmate Clayton Lockett.

Lockett, a convicted murderer, was set to die from lethal injection on April 29 in Oklahoma. But he appeared to be in considerable pain during the execution, which was called off after it was discovered that his vein had collapsed. He died of a heart attack a short while later.

“The extreme secrecy which surrounded lethal injection in Oklahoma prior to Mr. Lockett’s execution led directly to disastrous consequences. . . . Unless the courts demand that Texas proceed with a commitment to transparency and accountability, there is an unacceptable risk that other prisoners will be subjected to the torturous death suffered by Mr. Lockett,” Maurie Levin, one of Campbell’s attorneys, had said in a statement.

Texas officials defended the state’s lethal-injection protocols after the incident in Oklahoma, pointing out that there had been no incidents since it adopted its current method in July 2012. In Texas, executions are carried out with a single drug — pentobarbital — rather than the three-drug mixture used in Oklahoma.

Harper reported from Huntsville.