SACRAMENTO, Calif. (AP) — California will become the fifth state in the nation to allow terminally ill patients to legally end their lives using doctor-prescribed drugs after Gov. Jerry Brown announced Monday he signed one of the most emotionally charged bills of the year.

Brown, a lifelong Catholic and former Jesuit seminarian, announced that he signed the legislation approved by state lawmakers after an emotional and deeply personal debate. Until now, he had refused to comment on the issue.

The bill passed Sept. 11 after a previous version failed this year despite the highly publicized case of 29-year-old Brittany Maynard, a California woman with brain cancer moved to Oregon to end her life.

Opponents said the bill legalizes premature suicide, but supporters call that comparison inappropriate because it applies to mentally sound, terminally ill people and not those who are depressed or impaired.

Religious groups and advocates for people with disabilities opposed the bill and nearly identical legislation that had stalled in the Legislature weeks earlier, saying it goes against the will of God and put terminally ill patients at risk for coerced death.

The measure was brought back as part of a special session intended to address funding shortfalls for Medi-Cal, the state’s health insurance program for the poor. The governor had criticized the move to bypass the usual process.

The bill he received includes requirements that the patient be physically capable of taking the medication themselves, that two doctors approve it, that the patient submit several written requests, and that there be two witnesses, one of whom is not a family member.

California’s measure came after at least two dozen states introduced aid-in-dying legislation this year, though the measures stalled elsewhere. Doctors in Oregon, Washington, Vermont and Montana already can prescribe life-ending drugs.

Maynard’s family attended the legislative debate in California throughout the year. Maynard’s mother, Debbie Ziegler, testified in committee hearings and carried a large picture of her daughter as she listened to lawmakers’ debate.

In a video recorded days before Maynard took life-ending drugs, she told California lawmakers that no one should have to leave home to legally kill themselves under the care of a doctor.

“No one should have to leave their home and community for peace of mind, to escape suffering, and to plan for a gentle death,” Maynard said in the video released by right-to-die advocates after her death.

The Catholic Church targeted Catholic lawmakers before the bill’s passage and urged the governor to veto it.

“Pope Francis invites all of us to create our good society by seeing through the eyes of those who are on the margins, those in need economically, physically, psychologically and socially,” the California Catholic Conference said in a statement after its passage. “We ask the governor to veto this bill.”

Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.