The government's medicinal cannabis bill has passed its final hurdle in Parliament with the National Party labelling it "decriminalisation by stealth".
The legislation lays the groundwork for a medicinal cannabis industry with regulations to be in place within a year.
The bill passed its third reading on Tuesday afternoon with the support of Labour, New Zealand First and the Greens.
Health Minister David Clark said until a regime was set up, the legislation would help people ease their suffering with a wider range of medicinal cannabis products becoming available over time.
"We know that some people cannot wait for medicinal products to become more readily available and will want to use illicit cannabis to ease their pain," he said.
"People nearing the end of their lives should not have to worry about being arrested or imprisoned for trying to manage their pain. So as a compassionate measure we are also creating a statutory defence for people eligible to receive palliation so that they can use illicit cannabis without fear of prosecution."
The bill will introduce a statutory defence - or amnesty - as a stop-gap measure to allow people at the end of their lives to use illicit cannabis while the scheme is still being established.
Last month, Dr Clark said all palliative care patients would be allowed to use illicit cannabis without fear of legal repercussions after the government announced an expansion to its medicinal cannabis legislation.
"This is the most progressive legislation that has ever been passed through this House for the supply and access to medicinal cannabis products," Dr Clark said.
"It's about cultivation, cannabidiol and compassion, I'm very proud to commend this bill to the House."
Officials would seek feedback next year on how the scheme should operate and would develop quality standards alongside experts.
"It's important that those who are in the industry, those who are users, those who are consumers of products, and those with a wider interest be able to submit their views as the regulations are established," Dr Clark said.
He said medicinal cannabis products would be available on prescription.
The legislation includes the creation of a medicinal cannabis scheme to regulate and set quality standards of products both imported and made here.
It also removes cannabidiol from the schedule of controlled drugs, meaning the products will be much easier to purchase.
Of the nearly 1800 public submissions on this bill which led to the minister's changes, just one percent didn't support the idea of greater access to cannabis for medicinal use.
However, National leader Simon Bridges came out swinging in Parliament, calling the bill "decriminalisation of cannabis by stealth".
"What will the police do when they're outside a school and someone, under this bill, is smoking cannabis? What will they do?
"I don't reckon they'll do much at all," he said.
"Shame on the House for passing this terrible, unsafe, dangerous bill."
National's spokesperson for health Shane Reti also labelled the bill as "lazy and dangerous".
"This government is simply ticking the 100-day box that they were forced to by the Greens and it is permitting the smoking of drugs in our communities."
Mr Reti said National supported medicinal cannabis regulation but opposed the smoking of loose leaf cannabis in public.
"That's why we did the work and created a comprehensive medicinal cannabis regime that widened access to medicinal cannabis and provided a framework for licensing high-quality domestic production under sensible and achievable regulations.
"We offered to share our regime with the government but egos got in the way and we were turned down."
He said experts in the field should be the ones to decide what medical conditions were suitable for medical cannabis.
On the other hand, New Zealand cannabis company Zeacann, which is undergoing a $20m capital raising round to grow cannabis and manufacture medicines for domestic and export markets, welcomed the bill.
Co-founder Chris Fowlie said it was big step forward to helping New Zealanders who were suffering.
"The government is finally removing the stigma that cannabis has suffered from for decades," Mr Fowlie said.
He said it was good to see that a timeframe had been set for a legal framework on making the products available.
Zeacann estimates it will be able to begin growing cannabis in the first half of next year, once it has received a government licence.
The company aims to have ready for sale products by the time medicinal cannabis is legalised for sick patients across the board.