A Texas appeals court ruled Wednesday that a schizophrenic death row inmate cannot be forced to take medication which could make him mentally fit to be executed.

Steven Stanley, 51, had originally been scheduled to be executed in 2006, but he won a reprieve when he was found to be mentally incompetent.

Prosecutors sought permission to have him "involuntarily medicated" and after a lengthy legal battle were able to get the worst of his symptoms under control. Despite continuing to suffer from some delusions, Stanley was found to be mentally competent to be executed in 2012.

The state's criminal appeals court overruled that decision, arguing that the lower court lacked the authority to order Stanley's medication.

"We hold that the evidence conclusively shows that appellant's competency to be executed was achieved solely through the involuntary medication, which the trial court had no authority to order," Judge Elsa Alcala wrote in a 5-4 opinion.

"The evidence conclusively shows that (the) appellant is incompetent to be executed."

The justices issued no opinion as to whether the state or federal law allows the execution of a prisoner who had been forcibly medicated.

The US Supreme Court has ruled that mentally incompetent inmates cannot be executed but has not yet considered whether forcible medication is permissible in order to render an inmate mentally fit.

Stanley, who has spent 22 years on death row, was sentenced to die in for his role in a 1989 armed robbery that left a restaurant manager dead.