HONOLULU — Hawaii lawmakers approved legislation Thursday that would make it the latest liberal-leaning state to legalize medically assisted suicide.

The all-Democratic state Senate voted 23-2 to pass the measure that has already cleared the House. It allows doctors to fulfill requests from terminally ill patients for prescription medication that will allow them to die.

The governor has said he will sign the bill, which would make Hawaii the sixth state to legalize the practice, plus Washington, D.C.

The legislation includes safeguards intended to prevent abuse, but opponents said it puts the poor, elderly, sick and disabled at risk. Lawmakers have heard hours of impassioned testimony from advocates and opponents.

John Radcliffe, who was given six months to two years to live after being diagnosed with cancer in 2014, previously testified in favor of the measure and said Thursday that he was grateful it passed.

"I'm just glad that Hawaii has finally shown a little mercy with its justice," he said.

Radcliffe, who has been diagnosed with colon cancer that metastasized and spread to his liver, didn't attend the vote but said the legislation would help those struggling with pain, poor quality of life and stress.

"For some people, it will be a relief to know that in the end, they and their doctor can figure out medication that will put you to sleep and your family can be there. And all is well and — aloha," he said.

Sen. Breene Harimoto spoke Thursday about his battle with pancreatic cancer, saying he could never vote to create "an environment of hopelessness" that would allow a doctor to help cause death.

"My faith in God, prayers and sense of hope got me through this," the Democrat said. "Because of this personal experience, I feel so strongly that we must always have hope and never give up."

Sen. Russell Ruderman said the measure was about freedom.

"If you don't believe in it, don't do it. But there is no reason to deny to others the freedom to live and die as we choose," he said.

The chamber's only doctor, Sen. Josh Green, who works in an emergency room, voted for the bill but said he wished lawmakers would take more time for debate.

Hawaii Family Forum said in written testimony that the legislation may create subtle pressure on the elderly to end their lives early so they are not a burden to their families.

Among the safeguards are a requirement that two health care providers confirm a patient's diagnosis, prognosis, ability to make decisions and that they voluntarily made the request. A counselor also must determine that the patient is capable and does not appear to be suffering from a lack of treatment of depression.

The patient must make two oral requests for the life-ending medication, with a 20-day waiting period between each. They also must sign a written request witnessed by two people, one of whom can't be a relative.

The measure creates criminal penalties for anyone who tampers with a request or coerces a prescription request.

Gov. David Ige's administrative director, Ford Fuchigami, said the safeguards are sufficient to minimize abuse. He said in written testimony that the legislation will allow terminally ill patients to decide for themselves when and how their lives should end.

Doctor-assisted deaths are legal in California, Colorado, Oregon, Vermont, Washington state and the District of Columbia. Last year, the Hawaii Senate approved similar legislation, but the state House voted it down.

Montana doesn't have a law allowing or denying the practice, but its Supreme Court ruled in 2009 that doctors could use a patient's request for life-ending medication as a defense against criminal charges.

Some see providing the choice as a logical evolution in a medical care system that is advanced in helping people live longer but limited in preventing slow, painful deaths.

Critics say they are concerned that the option will lead to hasty decisions, misdiagnoses and waning support for palliative care, in which dying people can be sedated to relieve suffering.