WASHINGTON  In 1976, just six months after he joined the Supreme Court, Justice John Paul Stevens voted to reinstate capital punishment after a four-year moratorium. With the right procedures, he wrote, it is possible to ensure “evenhanded, rational and consistent imposition of death sentences under law.”

In 2008, two years before he announced his retirement, Justice Stevens reversed course and in a concurrence said that he now believed the death penalty to be unconstitutional.

But the reason for that change of heart, after more than three decades on the court and some 1,100 executions, has in many ways remained a mystery, and now Justice Stevens has provided an explanation.

In a detailed, candid and critical essay to be published this week in The New York Review of Books, he wrote that personnel changes on the court, coupled with “regrettable judicial activism,” had created a system of capital punishment that is shot through with racism, skewed toward conviction, infected with politics and tinged with hysteria.