An eastern Pennsylvania judge has ruled that state police troopers who said they smelled marijuana in a car weren't allowed to search it once they were shown a passenger's medical marijuana card.

A Lehigh County judge tossed out evidence cited in support of drug and firearms counts stemming from the Nov. 7 search in Allentown, The (Allentown) Morning Call reported.

"The smell of marijuana is no longer per se indicative of a crime," Judge Maria Dantos wrote in her opinion filed earlier this month.

Authorities said Timothy Barr, 27, was a passenger in the car driven by his wife that was stopped by state troopers on a traffic violation. Troopers said they smelled a strong odor of marijuana and told Barr that gave them the legal right to search the vehicle even after he showed them his card authorizing the use of medical marijuana. Officers found small amounts of marijuana and residue and also found a loaded handgun under the driver's seat. Court records indicate that Barr cannot legally possess a firearm due to a prior conviction.

In her ruling, Dantos said it was "illogical, impractical and unreasonable" for the troopers to suspect illegal activity once Barr showed them his medical marijuana card. She said Pennsylvania lawmakers never contemplated people with such cards being arrested and prosecuted for possession of marijuana in a package not clearly marked with a dispensary name.

"Such actions are merely means of hampering the legalization of marijuana for medical purposes," Dantos wrote.

Prosecutors must now decide whether to appeal to state Superior Court or try to move forward without the evidence. District Attorney Jim Martin said his office is reviewing the opinion and transcripts from a July 17 hearing and had made no decision on an appeal.

Defense attorney Joshua Karoly said the ruling could be the first step in changing a procedural rule that allows police to search a vehicle based on the smell of drugs alone.

"This case will put a spotlight on the plain smell doctrine in Pennsylvania which police use far too often to invade citizens' privacy," he said.

Dantos wrote in the opinion that officers' confusion over medical marijuana exemplified a "clear disconnect between the medical community and the law enforcement community." One trooper testified that he believed medical marijuana had no smell and the other said she mistakenly thought dried marijuana was illegal and not used for medical purposes. Marijuana in flower and dry leaf form has been offered at dispensaries since August 2018.