LOS ANGELES (AP) — Leaders in Los Angeles unanimously voted to ban the sale of high-capacity gun magazines, putting the city in the middle of the debate over national gun control following mass shootings nationwide and a boost in violent crime in some large cities.

The City Council says the measure it passed Tuesday will close a loophole in California law that bans the manufacture and sale of magazines holding more than 10 rounds of ammunition, but not their possession.

The Law Center to Prevent Gun Violence contends the magazines are a common thread in mass shootings, including at Sandy Hook Elementary School in Newtown, Connecticut, in 2012, the Los Angeles Times reported. The ordinance comes as gun-control legislation has failed to get off the ground following such massacres.

It coincides with an increase in the number of homicides this year in cities such as Houston, St. Louis, New Orleans and Baltimore. In Los Angeles, the number of slayings dropped slightly, but the number of shooting victims jumped more than 18 percent.

Mayor Eric Garcetti says he will sign the measure and it will go into effect 30 days after that. Those who have magazines will have a 60-grace period to legally sell, surrender or take them out of the city.

The National Rifle Association and other gun rights groups have threatened to sue, saying that the ordinance violates the Second Amendment and is pre-empted by state law.

Ammunition magazines that hold more than 10 rounds “are in common use for self-defense and they are overwhelmingly chosen for that purpose,” said Anna M. Barvir, an attorney with Michel & Associates, which represents the NRA and the California Rifle & Pistol Association.

“Indeed, millions are in the hands of good American citizens. As such, they are fully protected by the Constitution,” Barvir said in a statement.

Supporters of the measure say it is a small but important step in curbing violence, and Councilman Paul Krekorian said, “If the NRA wants to sue us over this, bring it on.”

“People who want to defend their families don’t need a 100-round drum magazine and an automatic weapon to do it,” Krekorian said during a rally before the Tuesday vote.

The effort to draft the ordinance started two years ago, and Ruett and Rhonda Foster said they wished the measure passed sooner.

Their 7-year-old son, Evan, died 18 years ago when a gunman sprayed a park with more than a dozen shots. If the killer’s shots had been limited before reloading, “Evan might still be here today,” Ruett Foster told the council Tuesday.