AUGUSTA, Maine — The Maine Legislature voted Tuesday to legalize assisted suicide, passing a bill that would allow doctors to prescribe terminally ill people a fatal dose of medication.

The bill now goes to Democratic Gov. Janet Mills, who has not indicated whether she will let it become law. Her office said she has not yet taken a position.

If Mills signs it, Maine would join seven other states, including New Jersey this year, with similar laws, according to The Death With Dignity National Center and the Death With Dignity Political Fund.

The bill would allow doctors to prescribe terminally ill people a fatal dose of medication and let people acting under it to defend themselves from being prosecuted for aggravated attempted murder, murder, or aiding or soliciting suicide.

The proposal passed the Democratic-led state Senate 19-16 on Tuesday after lawmakers recounted the last days of their own loved ones. The Democratic-led House had approved it Monday by the narrowest of margins — 73-72.

Maine has the oldest average state population. But as in other states, the proposal has divided supporters and critics across party lines.

Supporters, including Democratic Rep. Michele Meyer, have said no one knows how precious life is like a dying patient seeking a peaceful end.

But critics, including Republican Rep. Amy Arata, have argued doctors can make mistakes and the bill could have unintended consequences.

The legislation defines “terminal disease” as an “incurable and irreversible disease that has been medically confirmed and will, within reasonable medical judgment, produce death within 6 months.”

The proposal had failed once in a statewide vote and at least seven previous times in the Legislature. The bill’s Democratic sponsor said the latest language addresses criticism of past efforts that have failed in Maine.

The legislation defines “terminal disease” as an “incurable and irreversible disease that has been medically confirmed and will, within reasonable medical judgment, produce death within 6 months.”

The bill requires a second opinion by a consulting physician, along with one written and two verbal requests. A patient making an initial verbal request must wait 15 days before signing a written request, and then wait another 48 hours for the writing of a prescription for life-ending medication.

A person’s request for life-ending medication couldn’t affect insurance rates or be a condition in a will or contract. Maine would criminalize coercing someone to request life-ending medication, as well as forging a request for life-ending medication without the person’s knowledge.

Physicians would screen patients for conditions that could impair judgment, such as depression. Physicians must then send patients with such a condition for evaluation and treatment by a state-licensed mental health professional, who could allow the patient to receive life-ending medication only after deciding the patient’s judgment isn’t impaired by such a disorder.

An individual health care provider may choose not to participate in providing medication to end a qualified patient’s life but, if the patient requests the medical records be provided to another health care provider, the records must be transferred.

In 1997, Oregon became the first state to provide an end-of-life option. California’s law went into effect in 2016.

READ MORE: As doctors drop opposition, aid-in-dying advocates target next battleground states