TORONTO — The Canadian government on Friday announced an immediate ban on some 1,500 makes and models of “military-grade” assault weapons, including two models used by the gunman who killed 22 people last month in rural Nova Scotia during the country’s deadliest mass shooting.

“These weapons were designed for one purpose and one purpose only: to kill the largest amount of people in the shortest amount of time,” Prime Minister Justin Trudeau said during a news conference in Ottawa on Friday that began with him listing several mass shootings in the country’s history.

“There is no use — and no place — for such weapons in Canada,” he said. While most firearms owners are responsible, he said, “you don’t need an AR-15 to bring down a deer.”

The measures ban the purchase, sale, transport and use of the weapons. Trudeau said there will be a two-year amnesty period for gun owners to comply with the prohibition. He said legislation will be drafted in the coming months to provide “fair compensation” to them.

Trudeau, who pledged stricter gun-control measures during last year’s federal election, said his government had planned to introduce tougher rules in March but was delayed by the coronavirus pandemic. The ban partially fulfills his campaign promises, which also included plans to empower municipalities to ban handguns.

The ban will be enacted through regulations approved by cabinet, not through legislation in Parliament.

Andrew Scheer, the interim leader of the opposition Conservative Party, accused Trudeau of “using the current pandemic and the immediate emotion of the horrific attack in Nova Scotia to push the Liberals’ ideological agenda and make major firearms policy changes.”

The ban includes the AR-15, which has been used in several mass shootings in the United States, as well as the Ruger Mini-14, which was used in the 1989 massacre that left 14 dead at Montreal’s Ecole Polytechnique. Until last month, it was Canada’s deadliest mass shooting.

During the amnesty period, the firearms cannot be used or sold, but they may be exported if their owners have the proper permits. An exemption to the amnesty rules will be made for those who use the weapons for sustenance hunting until a replacement can be acquired.

In a later briefing, a government official who spoke on the condition of anonymity said that at least 105,000 of the now-banned firearms are in circulation.

The official said gun owners will be offered a choice of surrendering the firearm for compensation or participating in a “grandfathering” process at the end of the two-year amnesty. Details on both options are forthcoming, he said.

According to Statistics Canada, a firearm was used in 249 homicides in 2018, the most recent year for which data was available. A handgun was used in 143 of them. Shotguns, fully automatic firearms, sawed-off rifles and unknown guns were used in the rest.

Bill Blair, Canada’s public safety minister, said the government also plans to introduce legislation to strengthen gun storage laws, to prevent gun trafficking and to create “red flag” laws that would allow law enforcement to remove firearms from dangerous situations.

Police have said that Gabriel Wortman, the 51-year-old assailant in the mass shooting in Nova Scotia, did not have a license to own a firearm in Canada. He was armed with handguns and long-barreled weapons, some of which were obtained in the United States.

Nathalie Provost, a survivor of the Polytechnique shooting, said the ban has “been a long time coming.” But, she said, “what would have been a total victory for public safety has been tainted” by the possibility that the buyback program might be voluntary.

Rod Giltaca, chief executive of the Canadian Coalition for Firearms Rights, said his community is “devastated” by the ban. He said criminals will not turn in their weapons and that the move is “entirely political.”

Gun ownership is relatively common in Canada; the country ranked fifth in a 2018 global survey of civilian firearms per capita. But mass shootings are rarer than in the neighboring United States.

A spate of gun violence in recent years has fueled an increasingly divisive debate over gun control, largely pitting city dwellers, who tend to favor more restrictions, against those in rural Canada.