ALBANY, N.Y. — New York Gov. Kathy Hochul said Wednesday that she has reached a deal with state legislative leaders to approve a bill to give terminally ill people the legal ability to end their own lives with prescribed medication.

In an op-ed in the Albany Times Union, Hochul said she supports the proposal but has made an agreement with lawmakers to include “guardrails” in the measure before she signs it into law.

Hochul, a Catholic, said she came to the decision after hearing from New Yorkers in the “throes of pain and suffering,” as well as their children, while also considering opposition from “individuals of many faiths who believe that deliberately shortening one’s life violates the sanctity of life.”

“I was taught that God is merciful and compassionate, and so must we be,” she wrote. “This includes permitting a merciful option to those facing the unimaginable and searching for comfort in their final months in this life.”

A dozen other states and the District of Columbia allow medically assisted suicide, according to advocates. Illinois Gov. JB Pritzker signed legislation Friday that will allow terminally ill residents of that state to choose to end their lives.

New York’s Medical Aid in Dying Act requires that a terminally ill person who is expected to die within six month make a written request for life-ending drugs. Two witnesses would have to sign the request to ensure that the patient is not being coerced. The request would then have to be approved by the person’s attending physician as well as a consulting physician.

The governor said the bill’s sponsors and legislative leaders have agreed to add provisions to require confirmation from a medical doctor that the person “truly had less than six months to live,” along with confirmation from a psychologist or psychiatrist that the patient is capable of making the decision and is not under duress.

Hochul also said the bill will include a mandatory five-day waiting period as well as a written and recorded oral request to “confirm free will is present.” Outpatient facilities associated with religious hospitals may elect not to offer the option.

She added that “this is a right afforded to New Yorkers only.”

A spokesperson for Hochul said the governor will sign the bill into law next year, with her changes weaved into the proposal.

The legislation was first introduced in 2016 but stalled for years amid opposition from New York State Catholic Conference and other groups. The Catholic organization argued the measure would devalue human life and undermine the physician’s role as a healer.

In a statement after the governor’s announcement, Cardinal Timothy Dolan and the New York’s bishops said Hochul’s position “signals our government’s abandonment of its most vulnerable citizens, telling people who are sick or disabled that suicide in their case is not only acceptable, but is encouraged by our elected leaders.”

New York lawmakers approved the legislation during their regulation session earlier this year. Supporters said it would reduce suffering for terminally ill people and let them die on their own terms.