Bobby Moore has been on Texas’ death row for 39 years. On Wednesday, the Texas Court of Criminal Appeals officially changed his death sentence to one of life in prison, ending a yearslong battle between the high courts in Texas and the nation.

Now 60, Moore was sentenced to death in 1980 in the fatal shooting of an elderly store clerk during a Houston robbery. His attorneys have argued for years that he is intellectually disabled and therefore ineligible for the death penalty. The Court of Criminal Appeals has repeatedly disagreed, ruling twice that he did not qualify as intellectually disabled, including once after the U.S. Supreme Court had already slammed its first ruling.

But when the case went back to the U.S. Supreme Court, the justices made a clear determination in February that Moore was intellectually disabled, tying the hands of the Texas court.

“Having concluded that Applicant is a person with intellectual disability that is exempt from the death penalty, the Supreme Court has resolved Applicant’s claim in his favor,” the Texas court wrote in its ruling Wednesday. “There is nothing left for us to do but to implement the Supreme Court’s holding.”

Cliff Sloan, one of Moore’s attorneys, applauded the resolution.

“We greatly appreciate that the Texas Court of Criminal Appeals has implemented the Supreme Court decision and has ensured that justice is done regarding the inappropriateness of the death penalty for Bobby Moore,” Sloan said.

Harris County District Attorney Kim Ogg, who supported overturning Moore’s death sentence, said in a statement that she’s “proud the Court of Criminal Appeals agreed with us.”

“The science of measuring intellectual disability is advancing,” she said. “As prosecutors, we have a duty to ensure that the most up-to-date clinical standards are followed.”

Because Moore was sentenced to death in 1980 — before the punishment of life in prison without the possibility of parole was enacted and prisoners were eligible for parole after 20 years — he will automatically be eligible for parole. Ogg didn’t comment on that possibility Wednesday, but has opposed parole for an inmate in a similar position as Moore.