New Jersey is poised to become the eighth state to allow doctors to write a lethal prescription for terminally ill patients who want to end their lives.

The state Assembly voted 41-33 with four abstentions Monday to pass the “Medical Aid in Dying for the Terminally Ill Act." Minutes later, the state Senate approved the bill 21-16.

Gov. Phil Murphy later issued a statement saying he would sign the measure into law.

“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," the Democratic governor said. "I look forward to signing this legislation into law.”

The measure (A1504) would take effect four months after it is signed.

Susan Boyce, 55 of Rumson, smiled and wept after the final vote.

“I’ve been working on this quite a while," said Boyce, who is diagnosed with a terminal auto immune disease, Alpha-1 antitrypsin deficiency, and needs an oxygen tank to breathe.

Having the law “is something I want the option of,” Boyce said. “I don’t know what’s in store for me.”

In a debate before the vote, Assemblyman Jay Webber, R-Morris, asked his colleagues to delay voting.

“Once you cross this line, Mr. Speaker, there is no going back,” Webber said.

People, especially those who are elderly, often support assisted suicide because they do not want to burden their loved ones, Webber said. “Don’t make the right to die an obligation to die,” he said.

Assemblyman John Burzichelli, D-Burlington, who sponsored the bill with state Sen. Nicholas Scutari, D-Union, said there are enough safeguards to protect the vulnerable.

“The right of self determination stands firms no matter what … we control our destiny,” Burzichelli said.

In the Senate, Sen. Nia Gill, D-Essex, described the pain she watched her brother endure and her wish she could have helped him.

“I think you have a right to live your life in dignity, but you also have the right to end your life in dignity. And it’s not the pain simply. It’s being hooked to machines. It’s not being able to breathe on your own," Gill said.

“And when they look up at you and say, ‘Sis, I have had it, can you help me?’ I should have been able to. And I should have been able to have my brother, who used to be a football player for Montclair High School, to decide that he had had enough," Gill said.

California, Colorado, Hawaii, Oregon, Vermont, Washington and Washington D.C. enacted right to die laws. Montana’s “right-to-die” was established under a court ruling, which provides physicians a legal defense or immunity from prosecution.

The law would apply to New Jersey residents who have received a terminal diagnosis, defined as an incurable, irreversible and medically confirmed disease that will end the person’s life within six months.

The legislation specifically says disabilities are not terminal illnesses. Disability advocates say the law could make them vulnerable to coercion because their lives are not seen as worthy as others.

Other opponents insist there is no way for a doctor to determine when most people are going to die, and argue the law will unnecessarily convince people to stop treatment.

In order to get the prescription for the life-ending medication, patients will have to verbally ask their doctor twice over the span of 15 days. A second physician would need to verify the diagnosis, according to the bill.

Patients would also need to submit a request in writing, stating they had been “fully informed” of alternatives, such as palliative care and pain control. The declaration would need to be witnessed by two people who attest the person is acting voluntarily. One of the two must not be a relative or entitled to any portion of the patient’s estate or the person’s doctor.

Anyone who coerces a patient into requesting the medication would face up to three to five years in prison, a $15,000 or both, according to the bill. Doctors and pharmacists would also be protected from arrest or the loss of their license by complying with the law.

The latest poll on the topic taken by Rutgers University in 2015 found 63 percent of residents said they believed it was morally acceptable to let terminally ill people end their lives; 29 percent did not.

NJ Advance Media staff writer Samantha Marcus contributed to this report.

Susan K. Livio may be reached at slivio@njadvancemedia.com. Follow her on Twitter @SusanKLivio. Find NJ.com Politics on Facebook.