The Italian Senate approved the legislation on Thursday by 180 votes to 71, with six abstentions. The result, which gave the final green light to a measure that passed the Lower House in April, met with applause from senators and campaigners.
The new law will allow people to choose what medical intervention they wish to receive – or refuse – at the end of their life, including whether or not they want to be fed and hydrated artificially once they can no longer eat or drink by themselves.
No medical treatment can be started or continued without the patient's informed consent, and if they are not able to communicate, doctors will have to refer to the wishes set out in their "biological testament", or living will.
"The senate has cleared the way for a civilized choice," wrote Prime Minister Paolo Gentiloni on Twitter. "It's a step forward for human dignity."
#Biotestamento Dal Senato via libera a una scelta di civiltà. Un passo avanti per la dignità della persona— Paolo Gentiloni (@PaoloGentiloni) December 14, 2017
Gentiloni's Democratic Party (PD), backed by other parties on the left as well as the anti-establishment Five Star Movement (M5S), passed the measure despite opposition from the right, which claimed that it was the first step towards euthanasia.
The new law does not legalize euthanasia or assisted suicide, though right-to-die campaigners have said that is their next goal.
They have been calling for changes to Italian law for years. They point to the cases of Piergiorgio Welby, a writer suffering from muscular dystrophy who fought for the right to refuse treatment, and Eluana Englaro, a young woman sent into a persistent vegetative state by a car accident and kept alive for 17 years against the wishes of her family, who said she would have preferred to die.
The Italian Bishops' Conference, one of several Italian Catholic groups to protest the reform, said the law was "protecting doctors by relieving them of any responsibility, protecting the public health service... but apparently doing little to protect those suffering".
As a whole, however, the Catholic Church has softened its position on end-of-life care. The Vatican recently invited doctors to discuss the question, while Pope Francis has said that though the Church opposes euthanasia, there is no reason to subject dying patients to "excessive" care that prolongs their life at all costs.
The new legislation includes a provision to allow doctors to be conscientious objectors.
For people under 18 or judged mentally incapable of choosing their care, legal guardians will have the final decision.