Lawmakers in New Zealand voted almost unanimously on Wednesday to change gun laws, less than a month after its worst peacetime mass shooting, in which 50 people were killed in attacks on two mosques in Christchurch.

Parliament passed the gun reform bill, the first substantial changes to New Zealand's gun laws in decades, by 119 to 1. It must now receive royal assent from the governor general to become law.

"There have been very few occasions when I have seen parliament come together in this way, and I can't imagine circumstances when it is more necessary," Prime Minister Jacinda Ardern said in presenting the legislation.