New Zealand’s parliament has voted to ban military-style weapons, less than a month after 50 people were killed and dozens wounded in mass shootings at two mosques in the city of Christchurch.

A bill outlawing most automatic and semi-automatic weapons, and components that modify existing weapons, was passed by a vote of 119 to 1 in the House of Representatives after an accelerated process of debate and public submission.

The bill needs the approval of New Zealand’s governor general, a formality, before becoming law on Friday.

The prime minister, Jacinda Ardern, spoke emotionally during the bill’s final reading, telling of the traumatic injuries to the victims of the attacks on 15 March, whom she had visited in hospital.

“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.

“I could not fathom how weapons that could cause such destruction and large-scale death could be obtained legally in this country.”

Brenton Tarrant, a 28-year-old Australian, has been charged with 50 counts of murder.

Ardern, who has received international praise for her compassion and leadership since the shootings, was able to win rare bipartisan support for the bill, which makes it illegal to own a military-style semi-automatic rifle. The only dissenting voice was from the libertarian ACT party, which has one MP.

The law includes a buyback scheme under which the owners of outlawed weapons can surrender them to police in return for compensation based on the weapon’s age and condition. Anyone who retains such a weapon after the bill passes into law faces a penalty of up to five years in prison. There are some exemptions, including for heirloom weapons held by collectors or for professional pest control.

Ardern said lawmakers had a responsibility to act on behalf of the victims. “We are ultimately here because 50 people died and they do not have a voice,” she said. “We in this house are their voice. Today we can use that voice wisely.

“We are here just 26 days after the most devastating terrorist attacks created the darkest of days in New Zealand’s history We are here as an almost entirely united parliament. There have been very few occasions when I have seen parliament come together in this way and I cannot imagine circumstances where that is more necessary than it is now.”

Ardern said there had been some opposition from firearms owners, but that the response to the proposed legislation had been overwhelmingly positive. “My question here is simple. You either believe that here in New Zealand these weapons have a place or you do not. If you believe, like us, that they do not, you should be able to believe we can move swiftly. An argument about process is an argument to do nothing,” she said.