ROME — Italian lawmakers passed a law on Thursday allowing adults to decide, in concordance with their doctors, their end-of-life medical care, including the terms under which they can refuse treatment. The law permits Italians to write living wills and refuse medical treatment, artificial nutrition and hydration.

The bill had languished in Parliament for 30 years, facing strong resistance from conservative Catholic lawmakers, who presented more than 3,000 amendments to stymie its passage.

The amendments were rejected on Wednesday, before the final vote of 180 to 71.

This law was the result of grass-roots lobbying, “otherwise we would have never made it to the end,” said Donata Lenzi, the lower house lawmaker who sponsored the bill through that chamber earlier this year, speaking to a small group of the law’s supporters who had gathered to celebrate in front of the Italian Parliament on Thursday morning.

“This law does not take anything away from any ill person, this law gives,” Ms. Lenzi said. “Because it recognizes that until the end you are not just a body to heal but a person with your own mind, your own ideas, your own convictions and you have the right to be heard.”