Laws preventing firearms dealers from selling handguns to young adults under age 21 are unconstitutional, a federal appeals court said Tuesday in a ruling that could have implications for efforts to restrict such sales nationally.

In a divided decision, a three-judge panel of the U.S. Court of Appeals for the 4th Circuit said the existing minimum age requirement for purchases from federally licensed gun dealers restricts the rights of law-abiding citizens and draws an arbitrary, unjustified line.

“Despite the weighty interest in reducing crime and violence, we refuse to relegate either the Second Amendment or 18-to-20-year-olds to a second-class status,” wrote Judge Julius N. Richardson.

The decision, which probably will be appealed to the full court, finds that 18-year-olds possess a Second Amendment right to gun ownership and notes that they were “required at the time of the Founding to serve in the militia and furnish their own weapons,” wrote Richardson, a nominee of President Donald Trump, who was joined by Judge G. Steven Agee, a nominee of President George W. Bush.

The two expressed skepticism about the effectiveness of age restrictions, saying the requirement incentivizes young adults to obtain guns in less-regulated ways from unlicensed dealers and without background checks.

The ruling drew a sharp dissent from Judge James A. Wynn Jr. Courts, he said, should defer to lawmakers, who demonstrated a sufficient interest in promoting public safety when they passed the age restrictions in 1968.

“The majority’s decision to grant the gun lobby a victory in a fight it lost on Capitol Hill more than fifty years ago is not compelled by law. Nor is it consistent with the proper role of the federal judiciary in our democratic system,” Wynn wrote.

He rejected as “simply surreal” concerns about relegating the Second Amendment to second-class status.

“No, the Second Amendment is exceptional not because it is uniquely oppressed or imperiled, but rather because it is singularly capable of causing harm,” wrote Wynn, a nominee of President Barack Obama.

Tuesday’s ruling does not mean that 18-to-20-year-olds can immediately buy handguns from federal dealers. The court’s order sends the case back to District Court in Charlottesville and gives the government an opportunity to ask the full 4th Circuit to rehear the case.

In response to the ruling, a Justice Department spokesperson said, “We respectfully disagree with the court’s decision and are considering our options.”

The Supreme Court revived the broader legal battle over guns when it announced in April that it will consider a National Rifle Association-backed lawsuit asserting a constitutional right to carry a firearm outside the home. The high court has not issued a major opinion on gun control in more than a decade.

The challenge to the age restrictions was brought by prospective handgun buyers Natalia Marshall and Tanner Hirschfeld, who were unable to purchase firearms in Virginia because of their age.

Marshall had obtained a protective order against an abusive ex-boyfriend, according to court filings in the case. She grew up training with guns and believes handguns are an effective tool for protection, the documents say. Marshall preferred a licensed dealer because of the guarantee that the guns had not been used or stolen.

Attorney Elliott Harding, who represented the plaintiffs, said he was gratified that the court “recognized that these young adults are not second-class citizens.” The ruling will enhance public safety, he said, by allowing young people to purchase handguns in a more regulated market with background checks.

Gun-control advocates, who defended the law, pointed to studies showing that 18-to-20-year-olds commit gun homicides at a rate four times higher than adults 21 and older do.

Eric Tirschwell, managing director for Everytown Law, called the decision an outlier and said the full 4th Circuit should reverse it.

“We think it’s wrong on the history, wrong in the way it goes about its Second Amendment analysis and equally wrong for public safety at a time when we’re experiencing an epidemic with gun violence across the country. The last thing we need is for more guns to be in the hands of young people.”

Jonathan Lowy, chief counsel at Brady, a gun-control advocacy group, said it is a “dangerous ruling” that does not give proper deference to the government’s authority to prevent violence. When the Supreme Court in 2008 first declared a Second Amendment right to gun ownership in one’s home, he noted that the high court made clear other gun restrictions remain constitutional.

While federal law imposes an age limit of 21 for handgun purchases, the age limit for buying long guns is 18. Many states have passed more-restrictive age requirements for accessing firearms. For instance, in the aftermath of the 2018 mass shooting at a Parkland, Fla., high school, state lawmakers raised the minimum age to purchase rifles from 18 to 21.

A federal judge upheld the state restriction in June after a challenge from the National Rifle Association. Other federal appeals courts also have upheld either the federal law prohibiting handgun sales to 18-to-20-year-olds or state measures restricting sales based on age.