It was hardly a question whether Travis Runnels, the ninth and final Texas inmate executed on death row this year, had committed a murder. Over a decade ago, the Dallas native pleaded guilty in the 2003 killing of his former prison supervisor.

But things got far more complicated when it came to one of the witnesses in Runnels’s trial. The man’s attorneys charged that a state investigator, A.P. Merillat, had given false testimony. Prosecutors never denied that claim, and even Merillat recently suggested he may have erred.

Yet the question of whether his testimony made a difference in the verdict — and thus, between Runnels’s life and a life sentence — became central to a legal battle that lasted until this week.

“You shouldn’t be allowed to get a death sentence based on false testimony,” his attorney, Mark Pickett, recently told the Texas Tribune. “This is testimony that … no one is disputing is false.”

Prosecutors, however, argued that even if Merillat had misled jurors, it wouldn’t have made a difference in the verdict. They say that Runnels, who had a record of other assaults against prison guards, was too dangerous and would have been sentenced to death anyway.

Their years-long legal back-and-forth came to a close Wednesday, as Runnels, 46, died by lethal injection.

Runnels first landed in an Amarillo, Tex., prison over two decades ago, after receiving a 70-year sentence for an aggravated robbery in Dallas.

While he was behind bars, court documents say, he grew angry about his job as the janitor at an in-house boot factory, which made shoes for Texas prisoners. He had requested a work transfer to the prison’s barber shop but hadn’t received it.

On Jan. 29, 2003, before starting his shift, Runnels expressed his dissatisfaction to three other inmates, making violent threats about the plant manager, Stanley Wiley.

Once he arrived at the factory, Runnels went up to Wiley, tilted the man’s head back and slit his throat with a knife. The wound, spanning about nine inches, was so deep it had cut Wiley’s spine — and would later kill him.

Runnels wiped the knife clean with a white rag and walked away.

“It was cowardly,” prosecutor Randall Sims told jurors at Runnels’s trial, according to the Associated Press.

Though he knew the state wanted to sentence him to death, Runnels pleaded guilty. As a result, then, the question at his trial was not one of innocence. It was whether he could coexist with others during a life in prison or whether he posed such a “future danger” — to guards, inmates, and the public — that he should head to death row instead.

To answer that question, prosecutors called on Merillat to serve as an expert witness. Then a state official who investigated prison crimes, Merillat often testified in similar cases about the harm caused in prison by dangerous inmates.

At the 2005 trial, he appeared to do just that. He told jurors that inmates like Runnels could not be held securely, even if they were sentenced to life in prison without parole. He said that if those convicted of capital murder — like Runnels — were not sentenced to death, they would automatically be placed in dorms or cells alongside other inmates, without much supervision or consideration of their full records. His account, however, went against changes made months earlier to the Texas Department of Criminal Justice’s classification plan, which stated that capital murder convicts sentenced to life in prison would be placed at a stricter level of security.

Runnels’s attorneys said Merillat’s testimony was “plainly and patently false.” One former prison official would later tell Texas Monthly that it was “bulls---.” And in interviews with Texas news outlets, even Merillat acknowledged he might have been wrong in the Amarillo courthouse.

“When I testified, I testified with the knowledge that I had at the time,” he told the Tribune.

At the end of trial, the jury voted to put Runnels on death row. Their ruling triggered more than a decade of legal disputes, many of them centered on Merillat’s testimony: Had his statements, beyond a reasonable doubt, led the jury to choose a death sentence?

His attorneys argued it had. The purpose of Merillat’s testimony, they wrote in a petition, was to establish that prison security was “so lax” that Runnels would endanger others there.

Runnels had also received shoddy representation, they said. Plus, the sentences of two death row inmates, in 2010 and 2012, had been overturned after the Texas Court of Criminal Appeals ruled that Merillat gave jurors false information.

“Travis, just like anybody in this country, deserves a trial where people aren’t lying,” Pickett told the Houston Chronicle. “No matter what you did, what the jury should be hearing is the truth.”

Yet prosecutors said that Runnels’s crime — and his subsequent behavior in prison — was enough to make him a future threat in prison and merit a death sentence, with or without Merillat’s testimony. After killing Wiley, they said, Runnels threw feces and a lightbulb at other prison guards.

“The jury would undoubtedly have found Runnels to be a future danger,” Jefferson Clendenin, Texas assistant attorney general, wrote in a brief to the U.S. Supreme Court on Monday.

The case made its way through Texas courts, which repeatedly rejected his appeals. Runnels’s supporters argued that he had changed, following years on death row, but the prisoner’s options grew few and far between. Even Merillat seemed to come to his defense.

“If the jury gave him the death penalty because of his particular crime and the heinousness of it and the actions he committed after his crime … then the jury’s verdict should stand,” he told the Tribune. “If they gave him the death penalty because of what I said and I was wrong, I don’t want him to have the death penalty.”

Late on Wednesday afternoon, though, U.S. Supreme Court justices refused to block Runnels’s execution.

Less than an hour later, he was injected with a lethal dose of a sedative, while strapped into a death chamber gurney in Huntsville, Tex.

Outside the prison, about 70 miles north of Houston, several hundred Texas corrections officers stood in formation, KTVT reported, hugging or shaking the hand of Wiley’s sister and brother-in-law.

Inside, Runnels declined his chance to say any final words. Instead, he smiled and mouthed a kiss toward his friends and attorneys.

By 7:26 p.m., after four quick breaths, he was dead.