SEATTLE (AP) — An effort in Seattle to stop residents from tossing food scraps and other compost into the trash was ruled unconstitutional on Wednesday by a judge who said trash collectors poking through people’s garbage violates privacy rights.

King County Superior Court Judge Beth M. Andrus voided enforcement of the city ordinance in a written ruling, but she did not invalidate the ban on throwing away compost.

The now-defunct rule went into effect early last year, and it required trash collectors to tag garbage cans that contain more than 10 percent compostable material with education information.

ADVERTISEMENT

A group of homeowners sued the city over the ordinance, and lawyers representing them said it made garbage collectors snoop through trash like police detectives.

Andrus wrote that trash collectors’ search of garbage is a disturbance of people’s private affairs.

Robert Tad Seder, a lawyer for Seattle, said during an earlier court hearing that garbage collectors are simply glancing at the trash to see if there is any obvious compost. They already look for dangerous items and a host of other banned materials such as paint cans, he said.

Ethan Blevins, an attorney for the Pacific Legal Foundation who argued against the city in the previous hearing, said in a statement Wednesday that the ruling “is a victory for common sense and constitutional rights.”

“A clear message has been sent to Seattle public officials: Recycling and other environmental initiatives can’t be pursued in a way that treats people’s freedoms as disposable,” Blevins said.

The city initially intended to fine violators a dollar for each offense — a tactic that has been indefinitely delayed, said Andy Ryan, a spokesman for Seattle Public Utilities.

The rule was projected to divert as much as 38,000 tons of extra food waste from a landfill every year. Several other cities have passed similar food-waste laws, including Vancouver, British Columbia, San Francisco and Portland, Oregon.