LOS ANGELES — When doctors told Robert Stone last year that he had terminal cancer, he didn’t feel afraid.

Stone said he’d come to accept death as a natural part of life. What he did fear was having too little energy or too much pain to enjoy his remaining days.

So last month Stone, 69, became one of the first people in California to obtain lethal medications under a new state law that allows doctors to write prescriptions for terminally ill patients to kill themselves.

Stone said he won’t take the pills until the growing fatigue caused by his bone marrow cancer becomes debilitating.

“I’ll know that by how I feel,” he said. “It gives me some comfort in having control over what the end of my life will be like.”

Americans are planning for the possibility of living into their 80s or 90s, said Len Fishman, director of the Gerontology Institute at the University of Massachusetts, Boston. “They also know that that can mean living with serious physical and cognitive disease, and it’s making them think about what choices they would want to make if they were in that situation,” he said.

That’s led to more patients refusing intensive medical treatments just to prolong their lives, because there might be “some things worse than death,” Fishman said.

More controversially, it’s also contributed to a recent surge in the number of states looking into legalizing physician-assisted suicide – seen as either a humane option for the sick or the beginning of a dangerous trend in medicine.

Generally, attitudes toward death are changing in part because baby boomers – the oldest of whom reached retirement age five years ago – were the first generation to see many of their parents live into their 80s, Fishman said. They probably saw health conditions they wouldn’t want for themselves.

Stone recalled his mother’s last months with a grimace.

He remembers that when she was hospitalized for congestive heart failure in 1992, her hands were strapped to a hospital bed, a tube down her throat. She eventually ended up in a coma before dying weeks later at age 80.

Stone said his mother, father and uncle endured “excruciatingly painful” situations before they died.

“If they’d had a choice, I don’t think they would’ve done so,” he said.

In October, Stone’s doctors told him that his chemotherapy had stopped working and that he probably had one to two years left to live.

But unlike his mother’s, Stone’s last months will be peaceful, he said.

Since his diagnosis, he’s traveled to Vietnam and Japan, two countries he’d always wanted to visit. He recently read through stacks of letters written as long ago as 1962, fondly remembering old friends.

And for these happy final months, “I’m very thankful,” he said.

Since November 2014, legislators in more than 25 states have introduced bills that would legalize physician-assisted suicide – a fivefold increase from 2013, according to data collected by Compassion & Choices, an organization that advocates such laws.

Such laws face heavy opposition from some quarters.

Opponents say they fear these laws could be the beginning of a societal shift in which some people’s lives are deemed less valuable.

“It’s a very utilitarian attitude toward human life,” said Camille Giglio, head of the anti-abortion advocacy group California Right to Life. “To say simply because you’ve got an illness or you’ve got a disability … you should do the right thing and take yourself out of the world.”

Many doctors have historically been opposed to such laws, saying they go against their oath to save lives. A group of physicians in California has sued to overturn the state’s law.

In Oregon, Dr. Kenneth Stevens, an oncologist, has been fighting physician-assisted suicide since Oregon became the first state to legalize it in 1998. “It’s changing what doctors do, what hospitals do,” he said. “I can’t fathom why a doctor would do this.”