The greatest success of the American medical system is also its greatest failure. Thanks to amazing advances in biomedicine, doctors can keep you living long after you would have passed away in earlier years. Today a 65-year-old man can expect to live past age 82, and a 65-year-old woman can expect to live even longer. But those extra years can come at a terrible cost. Millions of Americans spend the last few years of their lives in and out of hospitals, racking up huge medical bills. A quarter of the total Medicare budget is spent on the last year of recipients’ lives, with 40% of that money going to their final 30 days. Worse than those billions, though, is the physical and psychological pain that accompanies aggressive end-of-life treatment. Intubations, dialysis, feeding tubes, invasive tests—for far too many Americans, the last phase of life is spent in a hospital intensive care unit, hooked up to machines.

It’s a terrible fate, as doctors only know too well. That’s why it shouldn’t be surprising that researchers in a new study in the journal PLOS ONE found that 88.3% of doctors surveyed reported that they would choose to forgo this kind of treatment if they were dying of a terminal illness. Yet even though they know how painful and futile those treatments are for dying patients—and would refuse them if the situations were reversed—doctors still find themselves carrying out those procedures on their own patients. “Physicians know it’s not the right thing to do, but we find ourselves participating in treatment that causes pain and suffering for our patient,” says Dr. VJ Periyakoil, the director of the Stanford Palliative Care Education and Training Program and the lead author of the paper. “Families are traumatized and there is a huge financial cost to the individual and the nation.”

Doctors aren’t alone. Periyakoil notes that surveys have found that more than 80% of patients say they wish to avoid frequent hospitalizations and high-intensity care at the end of their lives. So why then are so many Americans dying in exactly opposite the fashion that they and their doctors desire? Blame the same medical technology that has helped Americans live longer than ever before. Hospitals and doctors are reimbursed for carrying out procedures, whatever the end result. “The default of the medical system is to doing all possible technological care,” says Periyakoil. “It simply doesn’t make it easy to do the right thing.”

Medical schools bear some of the blame as well. Periyakoil notes that students are taught to extend their patients’ lives if at all possible, but they’re not taught how to speak to their patients and families about the reality of end-of-life care. That’s especially important because elderly, terminally ill patients are rarely in a position where they are capable of expressing their wishes, which too often leaves the decision up to the closest family members. And it’s hardly surprising that, faced with the possibility of losing a loved one, family members opt for whatever care is needed, no matter the financial or human cost. Periyakoil herself has spoken with the family of a terminally ill patient and gently suggested withdrawing extreme treatment, only to have the family push back. “We can present the options, but ultimately I have to defer to them,” she says.

Periyakoil says she published the study in part to show ordinary people what their doctors actually thought about intensive end of life care, with the hope that they would reconsider the need to extend the lives of their loved ones at all cost. This is fraught territory—just look at the hysteria over the so-called “death panels” during the initial Obamacare debates in 2009. But these conversations must be had, on the national level and the personal one. It’s projected that 26.1% of the U.S. population will be 65 or older by 2030, up from 12.8% now, and if intensive care remains the norm, costs will continue to balloon, while the elderly and the terminally ill will continue to suffer—as will their doctors standing witness to that pain.

“My goal is to prolong life—not prolong the dying process,” says Periyakoil. “We have to fix this.”

Contact us at letters@time.com.