Commissioner Raymond Kelly of the New York Police Department issued a memorandum in September ordering officers to follow a 1977 state law that bars them from arresting people with small amounts of marijuana, unless the drug is publicly displayed.

Yet a lawsuit filed in state court in late June charges that the police were still arresting people illegally — in clear violation of both the law and the memo — as recently as May. State data show that the number of marijuana arrests declined in the months after the directive was issued but began climbing again this spring.

The Legislature passed the 1977 decriminalization law to allow prosecutors to focus on serious crime and to stop police from jailing young people for tiny amounts of marijuana. It made possession of 25 grams or less of marijuana a violation punishable by a $100 fine for the first offense. To discourage public smoking of the drug, lawmakers made public display a misdemeanor punishable by up to three months in jail and a $500 fine.

The number of arrests in the city for minor possession declined after the law was passed but shot up from less than 1,000 in 1990 to 50,000 in 2011. And, of the nearly 12,000 16-to-19-year-olds arrested last year, almost 94 percent had no prior convictions and nearly half had never before been arrested. More than 80 percent of those arrested were black and Hispanic young people.