For almost 39 years, prosecutors in the Smith County District Attorney’s office have done their best to either send Kerry Max Cook to death row, keep him there, or—after he was freed on bond in 1997—prevent him from ever being able to walk the streets with absolute impunity. Today, these efforts stopped. This morning, in the 114th District Court of Smith County, district attorney Matt Bingham agreed to not contest Cook’s writ of habeas corpus—and to join with Cook’s attorneys in recommending that his murder conviction be overturned. Cook, who has sworn his innocence since he was arrested in August 1977 for the murder of Linda Jo Edwards, has finally been legally exonerated.

Cook’s lawyers had filed the habeas writ in 2015, then filed a couple of amended writs this past spring, containing additional grounds. The most important ground, and the one Cook wanted the most, was the first, claiming that he is “actually innocent.” The state didn’t address that claim but agreed the court should grant the writ based on ground number five, that “Mr. Cook’s due process rights were violated by the presentation of false testimony from James Mayfield.”

From 1977 to 1992, Mayfield—the boyfriend of Edwards, whom Cook was convicted of killing, had claimed that he and Edwards last had sex three weeks before her murder, and the prosecution used this to back up their assertion that the couple were just friends in that time; thus he had no motive to kill her. But in an April interview, Mayfield admitted that, in fact, the couple had had sex on June 8, the day before she was murdered. Mayfield also testified that he was not with Edwards in her apartment on the night of her murder—but a 1991 police report uncovered by Cook’s lawyers Gary Udashen and Bruce Anton found that Edwards’s roommate had told prosecutors that in fact she had seen Mayfield in the room with Edwards not long before she was murdered. This police report was not turned over to Cook’s lawyers before his trials in 1992 or 1994.

Cook gets relief under a 2009 Texas Court of Criminal Appeals decision, Chabot, where the court ruled that if a witness lies about a material fact, even if the prosecution didn’t know it was a lie, this is such a major violation of the defendant’s due process rights that he or she is entitled to have the conviction thrown out.

Mayfield’s material lie means that Cook will now be legally exonerated (subject to the approval of the CCA) though not “actually innocent.” How can a person be one and not the other? Legally, there’s often a difference between the two. Plenty of Americans have been exonerated and freed by filing a writ of habeas corpus and showing that their convictions came about as a result of a violation of their fundamental right to a fair trial—police coerced a confession, prosecutors hid exculpatory evidence. But it’s extremely difficult to go that extra step to prove you are “actually innocent”—the Texas CCA has ruled that the petitioner has to have new evidence that is so powerful that no jury would have convicted him, knowing about it. The gold standard for that new evidence? DNA, which Cook has, along with other new evidence, including crucial facts now revealed by Mayfield’s mendacity and the prosecution’s hiding of evidence.

Unfortunately for Cook, Judge Jack Carter, from Texarkana, did not rule on his actual innocence claim today, but set aside another hearing for June 29. The state is, at this time, still contesting Cook’s actual innocence claim, which could lead to him getting a compensation package from the state in excess of $1.6 million. Judge Carter also released all witnesses on today’s witness list from having to testify.

James Mayfield had shown up—and he and Cook both refused comment when they were out in front of the courthouse. Cook was jubilant talking to other exonerees and having his picture taken with his defense team. The frail Mayfield, on the other hand, was helped into a waiting car. He stared straight ahead—and was soon gone.