A small BB gun found in a felon’s car has been ruled a firearm by the Minnesota Court of Appeals, and its possession means more prison time for him.

Since 1977, the state’s two appellate courts have repeatedly agreed with the Legislature that a BB gun is a firearm when involved in various crimes, such as drive-by shootings.

As the result of a 2005 felony drug conviction, David Lee Haywood wasn’t supposed to have a handgun. The BB gun was found in his glove compartment during a traffic stop in 2013.

He was found guilty of a felony in Ramsey County District Court and received a mandatory minimum of five years in prison.

“It doesn’t matter if you bought a BB gun at Wal-Mart or a handgun at a gun shop,” said special assistant state public defender Grant Gibeau of the court’s reasoning. “Regardless of motive or intent, if you aren’t allowed to possess a firearm, you will end up going to prison.”

Haywood, 37, owned a Walther CP99 Compact .177-caliber BB gun. It looks like a standard Walther P99 handgun, the ruling said.

After police stopped his car, they discovered he had violated a no-contact order filed on behalf of a woman who was a passenger in the vehicle. Officers searched his car and found the BB gun.

During jury instructions for his trial on the weapon charge, the jury was instructed that a BB gun is a firearm under state law.

In general, a firearm is defined as a weapon from which a shot is discharged by gunpowder. A BB gun can’t be defined in that way because it doesn’t use explosive force, Gibeau argued.

The Appeals Court relied on a 1977 state Supreme Court case of an armed robbery in which the defendant used a BB gun. That fit the definition of a firearm in the game and fish laws, it was ruled.

More than a decade later, the Appeals Court had a similar ruling in a case involving a BB gun and a drive-by shooting. In 2006, the same court ruled that a BB gun is a firearm in a case where a person convicted of a violent crime is barred from owning one.

The ruling did note that the Appeals Court has encouraged the Legislature to comprehensively define the term “firearm,” but it has chosen not to do so since the 2006 ruling.

Gibeau said Haywood’s case will be appealed to the state Supreme Court, which hasn’t addressed the issue since the 1977 case.

According to the state Department of Corrections website, Haywood is expected to be released from prison in 2017.

Ramsey County Attorney John Choi said Monday’s ruling gives more clarity to the issue. Today’s BB guns have greater velocity and range than BB guns from years ago, he said.

“Many BB guns are made to replicate popular firearms,” he said. “It’s a dangerous situation for the public and law enforcement. The guns can kill people.”