Washington (AFP) - Nebraska has taken a major step closer to doing away with the death penalty, amid controversy over lethal injection that has some US states questioning the punishment and others digging in.

Despite a threat of veto from the state governor, the Nebraska senate endorsed the measure to replace the death penalty with life imprisonment on Thursday, according to official records.

Nebraska would join 18 other US states that have banned the death penalty if the bill becomes law.

Governor Pete Ricketts promised to veto the legislation, saying on Twitter that capital punishment "is an important tool for public safety and our prosecutors."

"Death row inmates have earned the penalty they received. They do not deserve the luxury of living on the taxpayer dime for a lifetime."

The legislature though could overturn the governor's veto with 30 votes -- the number of votes the bill received Thursday.

Executions have continued to decline in the United States with 11 states having abandoned the use of the death penalty without legally doing away with the punishment.

Around 80 percent of the country's executions take place in Texas, Missouri and Florida. The US federal government rarely imposes the death penalty.

A recent shortage of a drug used in lethal injections prompted a state scramble to find an alternative to move forward with executions.

Some inmates appeared in agony as they were executed with alternative drugs, prompting a public outcry and raising questions over whether the punishment is overly cruel.

The US Supreme Court is due to consider the controversy at the end of the month. A recent Pew survey puts US public support for the death penalty at 56 percent.

In the meantime, some states with the death penalty have tried to ensure scheduled executions go forward.

Utah reinstated the firing squad and Texas restocked supplies of the needed lethal injection drug from an anonymous supplier. Oklahoma passed a law Friday to allow execution by gas chamber.