LOS ANGELES (AP) — A U.S. appeals court ruled Wednesday that California’s ban on the sale of semiautomatic weapons to adults under 21 is unconstitutional.

In a 2-1 ruling, a panel of the San Francisco-based 9th U.S. Circuit Court of Appeals said Wednesday the law violates the 2nd Amendment right to bear arms and a San Diego judge should have blocked what it called “an almost total ban on semiautomatic centerfire rifles” for young adults. “America would not exist without the heroism of the young adults who fought and died in our revolutionary army,” Judge Ryan Nelson wrote. “Today we reaffirm that our Constitution still protects the right that enabled their sacrifice: the right of young adults to keep and bear arms.”

The Firearms Policy Coalition, which brought the case, says the ruling makes them optimistic other age-based gun bans will be overturned.

Ronald Macom, former firearms business owner and combat veteran believes the overturning was the right call.

“There’s a lot of people between the ages of 18 and 21 that are currently into shooting sports, that actually hunt. That go out and practice shooting,” Macom said.

He also brought up that many join the military right out of high school.

“And we got to remember people who are 17 to 35-years-old can join the military. And if they’re in the military, how can you say the military can give them a firearm, and then go out and train and practice with it but they can’t train or practice in their civilian world. Whether it be guard, reserve, or active duty?”

The ruling was not a total victory for gun rights advocates, who had sought to block the state from requiring a hunting license for purchases of rifles or shotguns by adults under 21 who are not in the military or law enforcement.

The court ruled the license requirement was reasonable for increasing public safety through “sensible firearm control.”

Handgun sales to those under 21 were already prohibited, but the stricter age limits for rifles and shotguns were passed in 2018 after some of the nation’s worst mass shootings were committed by young adults using rifles, including the Valentine’s Day 2018 slayings at Marjory Stoneman Douglas High School in Parkland, Florida.

Sacramento Mayor Darrell Steinberg believed the decision was a major setback.

“We just have to keep fighting. Put the faith in the next generation of leaders in our society, including judges to say, the second amendment does not mean that anybody should have the right to possess, to carry a weapon that can fire hundreds of rounds in just a few seconds. It’s only purpose is to injure, maim or kill,” said Steinberg.

The mayor said the recent mass shooting in downtown Sacramento illustrates the devastating consequences of these types of weapons.

“In a society that would say that it is OK for anybody, especially young adults to be able to possess semi-automatic weapons… They only need to see what went on in downtown Sacramento, just five-plus weeks ago to see what the consequences are of allowing the proliferation of these weapons.”

Attorney General Rob Bonta did not immediately comment.