New Zealand’s new sweeping gun laws outlawing military-style weapons went into effect Thursday morning – midnight local time – less than a month after 50 people were killed and dozens wounded at two mosques in Christchurch.

Governor General Patsy Redding signed the bill earlier Thursday, which imposes a penalty of up to five years in prison for anyone who retains such a weapon. Exemptions allow heirloom weapons held by collectors or weapons used for professional pest control.

Police said a gun buyback program will be announced to collect the now-banned weapons and that a brief amnesty program will be in effect until details of the program are announced.

20,000 ATTEND NEW ZEALAND VIGIL TO REMEMBER CHRISTCHURCH MOSQUE VICTIMS, SURVIVOR SAYS HE FORGIVES GUNMAN

"For people who find themselves now in possession of a prohibited firearm, we ask you to please notify us," Police Deputy Commissioner Michael Clement said. "The collection of firearms will occur at a later stage."

The sweeping law was passed following an accelerated process of debate and public submission by the House of Representatives on Wednesday by a final vote of 119 to 1. The only dissent was from the libertarian ACT Party’s lone lawmaker in Parliament.

NEW ZEALAND MOSQUE SHOOTING SUSPECT SENT LARGE DONATION TO AUSTRIAN FAR-RIGHT LEADER, SPARKING ANTI-TERROR PROBE

Prime Minister Jacinda Ardern spoke emotionally during the bill's final reading of the traumatic injuries suffered by victims of the March 15 attack, whom she visited in Christchurch Hospital after the shootings.

"I struggle to recall any single gunshot wounds," Ardern said. "In every case, they spoke of multiple injuries, multiple debilitating injuries that deemed it impossible for them to recover in days, let alone weeks. They will carry disabilities for a lifetime, and that's before you consider the psychological impact. We are here for them."

She added: "I could not fathom how weapons that could cause such destruction and large-scale death could be obtained legally in this country."

CLICK HERE TO GET THE FOX NEWS APP

Australian Brenton Harrison Tarrant, 28, used an AR-15 when he opened fire at two Christchurch mosques. He was charged with 50 counts of murder and 39 counts of attempted murder.

The Associated Press contributed to this report.