Texas’ House of Representatives on Thursday passed legislation that would ban the execution of severely mentally ill inmates.

We trust the Senate will support the bill as well, and Gov. Greg Abbott will sign it into law.

It’s a significant action in the most execution-happy state in the country.

It could spare the lives of dozens if not hundreds of current death-row inmates. A leading mental health advocacy group, Mental Health America, estimates that 5 percent to 10 percent of all death row inmates have some form of severe mental illness. With more than 2,600 inmates awaiting execution nationwide, nearly 230 of them in Texas, according to the NAACP Legal Defense and Education Fund, that means as many as 260 people might qualify for a change in sentence.

Even as we applaud the bill’s passage, however, we also question how so many mentally ill defendants wind up on death row. Aren’t courts supposed to determine if a person is mentally competent to stand trial, and isn’t one’s mental state considered during the trial process?

Many mental health professionals as well as capital punishment opponents find that process is faulty.

The American Civil Liberties Union, in a 2009 report on the issue, notes that mental health is a factor in many parts of the capital trial process.

The report says a mentally ill person can be vulnerable during interrogations by police. The high-pressure tactics used during such interrogations can lead a person with mental issues to give bad information, including false confessions, due to impressionability, delusions and deficits in cognitive reasoning.

Competency testing is faulty, the report found. The bar of competency is low. Courts and juries often find mentally ill defendants meet those low standards, as delusional and schizophrenic people might behave rationally even though their perception of reality might be irrational.

The ACLU report did find “an increasing recognition that severe mental illness is a reason to spare people not from responsibility for their crimes but from the ultimate sanction of death.”

Unfortunately, banning executions isn’t enough. We also need to look at the courts themselves. Justice might not always be paramount in the minds of some elected prosecutors and judges. There is no shortage of cases in which prosecutors withheld mitigating and even exculpating evidence in order to obtain a conviction. Many people seeking judicial seats are well aware that they might have a better chance of being elected if they promise to be tough on crime rather than saying they’ll be fair.

So while the possibility of an outright ban on executions of mentally ill inmates is welcome, it must be seen as a first step; after all, even without the ban mental illness should be determined during the trial process, and such inmates should not make it as far as death row.

State and federal justice officials should recognize the need for improvement in the evaluation of inmates, and for the development of distinct options in dealing with different forms of mental illness.

After all, justice is not simple retribution; rather, it is a complicated process that should consider factors that might have influenced the crime, and recognize that sometimes a culprit needs treatment rather than punishment.