This past Sunday, the Inquirer reported that Philadelphia police search thousands of cars every year after they smell marijuana inside. The department listed more than 25,000 car stops for the smell of weed in the past five years. That’s a lot of searches.

What’s more, under the law, once the police start to search a car based on the smell of drugs, they can rummage around, open up containers, purses, a locked glove compartment, even the trunk. They can confiscate any contraband they see, drug-related or not. They don’t even need a warrant.

Because warrantless car searches can be intrusive, it’s important to allow them only where police have probable cause to believe the car contains something illegal. But medical marijuana is legal under Pennsylvania law. Here in Philadelphia, the situation is even more confusing, because the recreational use of marijuana is essentially decriminalized. In fact, many people in this city seem to think that smoking marijuana is no longer illegal. If the police won’t arrest you for it, you won’t be convicted of it, and a doctor has given you a prescription for it, why can police search your car when they smell it?

The problem is, the laws are contradictory. The use of marijuana in Philadelphia may be decriminalized, but recreational use still violates state and federal law. Federal law has no exception for medical marijuana. Philadelphia may look the other way, but police can still use the presence of marijuana as a justification to search your car. Maybe they won’t arrest you for the weed, but the search may lead to something else.

The situation is confusing and dangerous, because we are sending conflicting signals to the public, and because police can take advantage of the confusion to undertake serious, intrusive searches. The Inquirer article also reported that these marijuana car searches mostly target black drivers and minority neighborhoods. That’s why it’s especially important to make sure that these searches are based on fair ground rules that everyone understands. It shouldn’t be OK for a white kid to smoke weed in a car in Rittenhouse Square, if the same activity will get your car searched if you’re black in Logan.

I want to make clear that I’m not jumping to conclusions about police misconduct. In my decades as a Philly prosecutor, I saw up close the honorable and conscientious way that police do their work. The problem is that right now, the rules don’t make any sense, and that will result in head-scratching outcomes even with the best intentions.

Philadelphia police must develop clear guidelines that outline, exactly, when the smell of marijuana justifies the search of a car. Authorities must ensure such rules are enforced fairly. And if we are serious that marijuana will not be treated as a crime in Philadelphia, these searches should be severely curtailed. Otherwise, we’re all just guessing, and that’s the worst possible situation.

Tom Dolgenos was an assistant district attorney in Philadelphia for over 20 years. He now lectures at the University of Pennsylvania and at Delaware Law School.