Toward the end, the pain had practically driven Elizabeth Martin mad.

By then, the cancer had spread everywhere, from her colon to her spine, her liver, her adrenal glands and one of her lungs. Eventually, it penetrated her brain. No medication made the pain bearable. A woman who had been generous and good-humored turned into someone her loving family hardly recognized: paranoid, snarling, violent.

California’s aid-in-dying law, authorizing doctors to prescribe lethal drugs to certain terminally ill patients, was two years from going into effect in 2016. But Martin did have one alternative to the agonizing death she feared: palliative sedation.

Under palliative sedation, a doctor gives a terminally ill patient enough sedatives to induce unconsciousness. The goal is to reduce or eliminate suffering, but in many cases the patient dies without regaining consciousness.

Martin’s older sister Anita Freeman said, “At least she got into that coma state versus four to eight weeks of torture.”

While aid-in-dying, or “death with dignity,” is now legal in seven states and Washington, D.C., medically assisted suicide retains tough opposition. Palliative sedation, though, has been administered since the hospice care movement began in the 1960s and is legal everywhere.

Doctors in Catholic hospitals practice palliative sedation even though the Catholic Church opposes aid-in-dying. According to the U.S. Conference of Catholic Bishops, the church believes that “patients should be kept as free of pain as possible so that they may die comfortably and with dignity.”

Other groups, such as the National Hospice and Palliative Care Organization, recommend that providers use as little medication as needed.

Since there are no laws barring palliative sedation, the dilemma facing doctors who use it is moral rather than legal, said Timothy Quill, who teaches psychiatry, bioethics and palliative care medicine at the University of Rochester Medical Center in New York.

Some doctors are hesitant about using it “because it brings them right up to the edge of euthanasia,” Quill said.

But many doctors who use palliative sedation say the line that distinguishes palliative sedation from euthanasia, including aid-in-dying, is intent.

Thomas Strouse, a psychiatrist and specialist in palliative care medicine at the UCLA Medical Center, said, “The goal of aid-in-dying is to be dead; that is the patient’s goal. The goal in palliative sedation is to manage intractable symptoms.”

Harlan Seymour said his wife, Jennifer Glass, received palliative sedation in 2015. A nonsmoker, she had metastatic lung cancer and faced a miserable death from suffocation brought on by fluids filling her lungs, her husband said.

Seymour said he wishes aid-in-dying had been available for his wife, but he did regard palliative sedation as a mercy for her. “Palliative sedation is slow-motion aid-in-dying,” he said. “It was better than being awake and suffocating, but it wasn’t a good alternative.”