HARRISBURG, Pa. — A federal appeals court has ruled that some people convicted of comparatively minor state crimes should get a chance to legally own guns, issuing a divided decision that reshapes longstanding rules.

The 3rd U.S. Circuit Court of Appeals on Wednesday sided with two Pennsylvania residents, deeming their crimes as minor even though they could have produced jail time of more than two years.

The court restored gun ownership rights to Daniel Binderup of Manheim, Pennsylvania, who pleaded guilty in Pennsylvania in 1998 to misdemeanor corruption of minors for a consensual sexual relationship with a 17-year-old girl working at his bakery. He received probation and a fine, but the offense carried a potential sentence of five years.

It also ruled in favor of Julio Suarez of Gettysburg, Pennsylvania, who pleaded guilty in Maryland to misdemeanor possession of a handgun without a license, a conviction that could have sent him to jail for three years. He received a suspended sentence and a fine.

The 3rd Circuit majority ruled that the federal gun ownership ban requires the offenses to be considered serious crimes, rather than simply carry state sentences of at least two years or more. The judges noted that both Pennsylvania and Maryland graded Binderup and Suarez’s conviction as misdemeanors. The decision was 8-7, although there was division among the majority about how challenges to gun prohibitions will play out in the courts.

“With not a single day of jail time, the punishments here reflect the sentencing judges’ assessment of how minor the violations were,” wrote U.S. Circuit Judge Thomas Ambro.

He said the U.S. attorney’s office made claims that Suarez is likely to misuse firearms as a “potentially irresponsible” person and that Binderup was likely to commit crimes in the future, but the judge said “neither the evidence in the record nor common sense supports those assertions.”

In a separate opinion, U.S. Circuit Judge Thomas Hardiman said that there has long been a public understanding that gun ownership rights under the Second Amendment can be taken away from people who “demonstrated that they would present a danger to the public if armed.”

“The government has presented no evidence that either Binderup or Suarez has been, or would be, dangerous, violent, or irresponsible with firearms,” Hardiman wrote.

A dissent from U.S. Circuit Judge Julio Fuentes said Congress has the right to deny gun ownership to people convicted of crimes, and that a potential sentence of more than two years means a crime constitutes a serious offense.

“Binderup and Suarez are, in effect, saying, ‘Trust us: we are not the kind of people who will cause future gun violence,'” Fuentes wrote. “The problem is that it is practically impossible to make this kind of individualized prediction with any degree of confidence. Mistakes — costly ones — are simply too likely.”

Their lawyer, Alan Gura, said he expects the Justice Department will appeal to the U.S. Supreme Court.

“It’s difficult to see what the public interest is in disarming these plainly nonthreatening individuals,” Gura said.

He said people who think the decision means they can now own guns will have to go to court and convince a judge they meet standards that were set out in the ruling.

A Justice Department spokeswoman said the agency declined comment.