Voluntary assisted dying will now become law in Western Australia after the Lower House approved amendments made to the controversial bill. The legislation will allow West Australian adults to end their life if they have a terminal illness which has left them with six-months to live.

Western Australia has voted to legalise voluntary assisted dying, bringing to an emotional end a lengthy and often heated parliamentary debate.

MPs exchanged hugs and onlookers in the public gallery burst into applause as the lower house on Tuesday spent more than five hours approving the last of 55 amendments to the government’s bill before rising.

WA is the second Australian state after Victoria to legalise voluntary assisted dying, with the scheme expected to be implemented in 18 months.

Health Minister Roger Cook, who oversaw the bill’s introduction and was applauded by MPs on both sides for his handling of the process, choked back tears as he welcomed the passing of the legislation.

“We are at the end of a very long process, a momentous process for the West Australian parliament and West Australian public,” he told the chamber.

“It’s not a time for jubilation.

“Everyone knows what this legislation is about. It’s about reflection. And to reflect that we’ve chosen compassion and the right to choose.”

More than 180 hours were spent debating the legislation in parliament, mostly in the upper house where it was heavily amended.

Terminally ill adults in pain and likely to have less than six months to live – or one year if they have a neurodegenerative condition – will be able to take a drug to end their lives if approved by two medical practitioners.

“This is an extraordinary piece of legislation,” Mr Cook said. “Western Australia is not known for its progressiveness in terms of its legislative reform.

“I’d like to think we’ve come a respectable second (to Victoria).” The parliamentary debate was often heated, with many MPs critical of Premier Mark McGowan for pressuring the upper house to get on with passing the bill. MPs were granted a conscience vote and Labor backbencher Adele Farina was among the final dissenters in the upper house.

The premier hailed the passing of the bill as a significant moment for the state.

“Today we showed that at least in Western Australia, we can do big things,” Mr McGowan said.

“And in this parliament we have big, compassionate hearts and we’re willing to take some political risks to do the right thing.

“For those of you who are worried about your own futures and don’t want to die that way … we thank you for your unwavering support.

“Thank you for your patience. We did it for you.”