Modesto's ban on Dumpster diving withstood pleas to overturn the measure Tuesday. It will take effect Feb. 21.
People who dig through garbage containers could face $500 penalties and time in jail if police catch them.
The City Council adopted the measure by a 4-2 vote, with Janice Keating and Will O'Bryant in the minority. They urged their colleagues to enact a different version of the law with less serious penalties, such as a $100 citation.
In a separate, unanimous vote, the council increased penalties for drinking alcohol in city parks without a permit. The vote makes the offense a misdemeanor instead of an infraction and punishable by a $500 fine and time in jail.
Police helped write each proposal and touted them as tools to aid them in dealing with neighborhood complaints.
"Both of these ordinances, they're really about these very few cases where the officer needs a particular kind of assistance to resolve the situation," Councilman Brad Hawn said.