“This measure is about dignity,” Murphy said in a statement . “Allowing terminally ill and dying residents the dignity to make end-of-life decisions according to their own consciences is the right thing to do. I look forward to signing this legislation into law.”

Gov. Phil Murphy (D) said Monday he would sign the legislation into law, praising the work of lawmakers to turn New Jersey into “a more dignified and empathetic state.”

State lawmakers passed bills in the New Jersey Assembly and Senate on Monday approving the measure , which would take effect later this year. The “Medical Aid in Dying for the Terminally Ill Act” would allow patients with six months or less to live to self-administer life-ending medication.

New Jersey is poised to be the latest state in America to allow terminally ill people the right to end their own lives.

The #NJ Assembly and Senate have passed the Medical #AidInDying for the Terminally Ill Act! Thank you to all bill sponsors and supporters! @njassemblydems @NJAssemblyGOP @NJSenDems @senatenj pic.twitter.com/thSeMwiq0H

New Jersey has tried for years to pass right-to-die legislation, but efforts dating back to 2012 have failed. Votes in 2014 and 2016 passed in the lower chamber of the Legislature but weren’t able to pass in the Senate.

Democrats praised the latest efforts on Monday, with state Sen. Nicholas Scutari (D) noting the initiative could become one of the “most consequential bills that we’ll act on in our time here.”

“There is no good reason for them to be forced to prolong their pain and suffering or to prolong the grief of their loved ones if they make that choice,” Scutari said in a statement on Monday, according to The Associated Press.

The bill would require anyone seeking life-ending medication to consult with two doctors who would need to agree that a patient had less than six months to live. A person would then have to ask for the medication three times, including one time in writing that would have to be witnessed by two people.

Patients would then be required to self-administer the medication.

Some Republicans had argued that the onus could fall too heavily on doctors. “What if they’re wrong?” state Sen. Robert Singer (R) asked on the chamber floor before the vote, according to NorthJersey.com. “What if they made a mistake and that person is not going to die?”

However, advocates for the bill cheered the news.

“I am eternally grateful to the bill author, Assemblyman John Burzichelli, for tirelessly championing this legislation for nearly seven years and for every member of the legislature who voted for it,” Susan Boyce, a New Jersey resident with a terminal lung disease, said in a statement. “I urge Governor Murphy not to wait 45 days and to sign this bill promptly, so I have this option to ensure I don’t have to suffer needlessly at the end of my life.”

Six other states and the District of Columbia have “death with dignity” statutes on the books, and Montana has made the process legal through the court system. Twenty others are considering similar legislation this year.