Doctors are trained to do everything they can to save their patients’ lives. This imperative is fundamental and deeply ingrained. But the Covid-19 pandemic is turning this goal — and the very practice of medicine — upside down.

Surging numbers of patients and the pronounced lack of protective equipment are putting countless physicians and nurses at risk, forcing them to re-evaluate how they care for their patients. They are practicing battlefield medicine and making decisions that could put them at risk of civil or criminal liability.

On Friday, Gov. Andrew Cuomo signed legislation immunizing health care providers for medical decisions they make in the course of providing care to victims of the pandemic during the duration of the emergency that he declared on March 7. This action is vital to protecting doctors and nurses on the front lines of this crisis.

Other states should follow New York’s example with dispatch.

Whether to provide CPR to a Covid-19 patient on a ventilator offers one stark example of the many decisions doctors are being forced to make, illustrating the risks they face in making these choices, and why other states should protect their health care workers from legal liability for these decisions.