It was the 1970s, and marijuana raids and mass arrests had been sweeping college campuses and suburban concert venues in New York. The crackdown outraged parents. There was talk of ruined reputations and “Gestapo” police tactics.

State legislators in 1977 devised what they took to be a simple fix: a bill that made carrying small supplies of marijuana a ticket-worthy violation, not a crime. To win enough votes from Republicans, the authors carved out an exception that said it was still a crime to carry marijuana “open to public view.”

The bill’s backers thought the addition was harmless enough, given that people did not usually take out their stash in front of the police anyway. The era of mass arrests for carrying around marijuana seemed to be over.

It wasn’t.

Annual arrests for marijuana possession, which dipped below 1,000 by the early 1990s, rocketed above 50,000 during some years in New York City under Mayors Rudolph W. Giuliani and Michael R. Bloomberg. Officers strayed so far from the bounds of the 1977 law that in 2011, the police commissioner, Raymond W. Kelly, had to issue an order reminding officers not to arrest people who had marijuana hidden in their pockets.