Washington's Supreme Court unanimously struck down the state's death penalty Thursday, ruling that it had been used in an arbitrary and racially discriminatory manner.

Washington has had a moratorium on executions since 2014, but the ruling makes it the 20th state to do away with capital punishment by legislative act or court decree. The court converted the sentences of the eight people on Washington's death row to life in prison.

"The death penalty is unequally applied -- sometimes by where the crime took place, or the county of residence, or the available budgetary resources at any given point in time, or the race of the defendant," Chief Justice Mary Fairhurst wrote in the lead opinion.

She added: "Our capital punishment law lacks 'fundamental fairness."'

Defense lawyers had long challenged the death penalty on those grounds, noting the state's worst mass murderers and serial killers, Green River killer Gary Ridgway among them, had received life terms, not death. In a 5-4 ruling in 2006, the justices rejected an argument from a death row inmate that he shouldn't be executed because Ridgway hadn't been executed.

This time, death penalty critics were armed with more data about how capital punishment works, including a statistical analysis by University of Washington sociologists. Their report showed that although prosecutors were not more likely to seek the execution of black defendants, juries were about four times more likely to sentence black defendants to death.

"Now the information is plainly before us," Fairhurst wrote. "To the extent that race distinguishes the cases, it is clearly impermissible and unconstitutional."

Gov. Jay Inslee, a one-time supporter of capital punishment, imposed the 2014 moratorium. In a written statement, the Democrat called the ruling "a hugely important moment in our pursuit for equal and fair application of justice."

"The court makes it perfectly clear that capital punishment in our state has been imposed in an `arbitrary and racially biased manner,' is `unequally applied' and serves no criminal justice goal," Inslee wrote.

The ruling came in the case of Allen Eugene Gregory, a black man who was convicted of raping, robbing and killing Geneine Harshfield, a 43-year-old woman, in 1996.

His lawyers, Neil Fox and Lila Silverstein, said the death penalty is arbitrarily applied and that it is not applied proportionally, as the state Constitution requires.

"However one feels about the propriety of capital punishment in theory, in practice the death penalty is imposed in an unfair, arbitrary, and racially biased manner," Silverstein said in a written statement. "The Supreme Court properly ruled the Washington Constitution does not tolerate such an unfair system."

Dozens of former state judges took the unusual step of urging the court to use Gregory's case to strike down capital punishment. Among them was former Justice Faith Ireland, who sided with the narrow majority in upholding capital punishment in 2006.

In Thursday's decision, the court did not rule out the possibility that the Legislature could come up with another manner of imposing death sentences.

"We leave open the possibility that the legislature may enact a 'carefully drafted statute' to impose capital punishment in this state, but it cannot create a system that offends constitutional rights," the opinion said.

Attorney General Bob Ferguson said he would press the Legislature to make the sole punishment for aggravated murder life in prison without release.

The court did not reconsider any of Gregory's arguments pertaining to guilt, noting that his conviction for aggravated first-degree murder "has already been appealed and affirmed by this court."

Earlier this year, the state Senate passed a measure abolishing the death penalty, but it failed to pass in the House.

"There is a profound shift in our state and country that the death penalty is below us as a civil, just and moral society," Democratic Sen. Reuven Carlyle, who had been a sponsor of those previous attempts, said in a text message.