Washington became the 20th state to do away with the death penalty on Thursday when the state's Supreme Court ruled that the way the punishment is carried out violates the state constitution.

The court ruled that the death penalty is applied unequally, depending on where the crime took place, the race of the defendant and the budget available to county prosecutors at any given time.

"The death penalty, as administered in our state, fails to serve any legitimate penological goal," the court said.

Gov. Jay Inslee, a Democrat, praised the decision. "This is a hugely important moment in our pursuit for equal and fair application of justice," he said.

Inslee imposed a moratorium on capital punishment in 2014, concluding that it was not uniformly applied and was unnecessary given the option of seeking a life sentence without parole.

The ruling Thursday came in the case of Allen Eugene Gregory, who was convicted of raping and murdering a woman, Geneine Harshfield, 46, in 1996. The court did not overturn Gregory's murder conviction, but converted his death sentence and those of seven others on Washington's death row to life sentences.

Washington has carried out five executions since 1976, when the U.S. Supreme Court struck down the death penalty nationwide, then allowed states to reimpose it under revised trial procedures.

After peaking in 1999, the number of executions carried out nationwide has steadily dropped, partly as a result of the concern about wrongful convictions prompted by the progress in using DNA evidence.

Executions and the imposition of new death sentences remained near historically low levels in 2017, and public support for the death penalty fell to its lowest point in 45 years.

The ACLU had urged the Washington court to strike down capital punishment. "There is nothing unique about the role racism played in Washington's death penalty," said Jeff Robinson, an ACLU attorney. "What is rare is the Supreme Court's willingness to call out the truth that has always been there."