A federal appeals court has ruled that California’s ban on the sale of semiautomatic weapons to adults under age 21 is unconstitutional.

A panel of the 9th U.S. Circuit Court of Appeals on Wednesday determined the law violates the 2nd Amendment right to bear arms. The court in a 2-1 ruling says a San Diego judge should have blocked what it called “an almost total ban on semiautomatic centerfire rifles” for young adults.

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

There was no immediate response from California Attorney General Rob Bonta.

-Jeff Lemucchi