The city council of Boulder, Colorado has voted to ban semi-automatic rifles – a weapon used in several recent US mass shootings.
The military-style rifle is carried by soldiers around the world, and is legally available for adults to purchase throughout the US.
The city council on Tuesday unanimously passed the measure, which also bans high-capacity ammunition magazines.
Gun rights advocates say they plan to challenge the new law in court.
The move comes three months after a school shooting in Parkland, Florida left 17 people dead. The attack renewed a national debate on gun control and large-capacity magazines, but no federal action was taken.
Following the Parkland shooting, US President Donald Trump proposed a ban on bump stocks – which enable assault-style rifles to shoot hundreds of rounds a minute – to the US Department of Justice.
The public comment period on the bump-stock ban proposal expires on 27 June.
Boulder officials banned bump stocks, which entered the US gun debate after 58 people were killed and more than 850 injured in a Las Vegas shooting last year.
The bill describes assault-style rifles as “semi-automatic firearms designed with military features to allow rapid spray firing for the quick and efficient killing of humans”.
The bill, however, contains a grandfather clause allowing residents who currently own the weapon to keep it after a 15 June enforcement deadline.
But lawyers for the nonprofit group Mountain States Legal Foundation say they plan to sue the city and officials on the basis that the law violates the US and Colorado constitutions.
Over the weekend rifle-carrying protesters rallied against the proposed law.
Current assault-style rifle owners would need to register the weapon with local police. Bump stocks, high-capacity magazines, and weapons with a multi-burst trigger are not subject to the grandfather clause and must be forfeited.
City lawyers and law enforcement officials have acknowledged the difficulty of enforcing the new law.
But council members lauded its passage as one that affirmed the city’s values and commitment to ending gun violence, the Boulder Daily Camera reports.
“My hope is that we will see more bans at the state level and one day at the federal level so these weapons will no longer be available,” Boulder Councilman Aaron Brockett reportedly said before the vote.
Boulder is not the first local municipality in the US to pass new gun restrictions in recent months.
In April, the Chicago suburb of Deerfield, Illinois voted to ban assault-style rifles and fine owners up to $1,000 (£740) per day.