A sweeping nationwide ban on most semiautomatic weapons took effect in New Zealand on Saturday, as a monthslong gun buyback and amnesty program ended amid debate over its success.

Prime Minister Jacinda Ardern had announced a temporary ban just days after a terror attack on two mosques in Christchurch in March that left 51 people dead and was streamed live on Facebook. Weeks later, all but one of Parliament’s 120 lawmakers voted to make the ban permanent. It outlaws military-style semiautomatic weapons and assault rifles, and some gun parts, and violators face five years in prison.

A buyback, which began in July, was intended to allow gun owners to sell their weapons without penalty before the ban took effect. In a statement on Friday, Minister of Police Stuart Nash said that more than 56,000 prohibited firearms had been collected from about 32,000 people through the buyback, a number that was consistent with the authorities’ expectations.

But he added that the police did not know exactly how many guns there were in the country, complicating efforts to precisely gauge the buyback's success. Mr. Nash called for a national register to allow the police to track firearms. Recent police estimates had put the number of total firearms in the country at about 1.2 million.