Maine legalized assisted suicide on Wednesday, becoming the eighth state to allow terminally ill people to end their lives.

Democratic Gov. Janet Mills signed the Maine Death with Dignity Act, allowing doctors to prescribe terminally ill patients a fatal dose of medication, two decades after Oregon first legalized the procedure.

California, Colorado, Hawaii, Vermont, Washington, New Jersey and the District of Columbia have similar laws.

The Maine bill says getting or giving life-ending medication does not qualify as suicide under state law, effectively legalizing the practice often called medically assisted suicide.

Some residents of the state with the nation's oldest median age welcomed the governor's decision.

'What I want is a peaceful death':Kevin Roster has only weeks to live – and that's why he moved to California

Staci Fowler recalled how her late friend, Rebecca VanWormer, pushed for the bill four years ago. VanWormer, whose breast cancer spread to her bones, died in 2017.

“This is what she wanted,” said Fowler, an educational consultant in Gardiner. “And now everybody has the option that she didn’t have.”

A patient age 18 or older must undergo two waiting periods, submit one written and two verbal requests, and get the opinions of two physicians that a fatal dose of medication is appropriate. Doctors must also screen patients for conditions that can impair judgement, such as depression.

Legalization:With D.C. and California laws in jeopardy, a fresh debate over medical aid in dying

The proposal previously failed once in a statewide vote and at least seven times in the legislature. Opponents say such policies put terminally ill people in danger of abuse.

“Assisted suicide is a dangerous public policy that puts the most vulnerable people in society at risk for abuse, coercion and mistakes,” said Matt Valliere, executive director of Patients Rights Action Fund, an advocacy group. “It also provides profit-driven insurance companies perverse incentives to offer a quick death, rather than costly continuing quality care."

The bill defines “terminal disease” as one that is incurable and will likely end in death within six months. It also makes pressuring someone to request life-ending medication a crime.

Contributing: The Associated Press