The Montgomery County Council, following the lead of the District and other localities, voted Tuesday to ban polystyrene containers and clingy “packing peanuts,” calling them a pervasive source of litter and water pollution.

The measure, which passed by an 8-0 vote, bars restaurants, supermarkets and institutional cafeterias from using containers, plates, cups, egg cartons and other products made of the substance more commonly known as Styrofoam. Beginning in 2017, those businesses will be required to use compostable or recyclable materials.

The county has a Styrofoam ban in place in its cafeterias. Montgomery schools are phasing out their use of foam food service trays.

A 2010 report by the Anacostia Watershed Society found that about 22 percent of the trash collected by a trap along Nash Run, a stream that flows into the Anacostia, was bits of polystyrene foam.

“It stays there for hundreds, perhaps thousands of years,” said Council member Hans Riemer (D-At-Large), lead sponsor of the bill. “You don’t notice how omnipresent these materials are.”

The bill will also bar the sale of polystyrene loose-fill packaging, commonly referred to as “packing peanuts.” The intent is to encourage use of recyclable biodegradable packing supplies or the sealed air packing materials used by some online retailers.

The law will be enforced by the Department of Environmental Protection on a “complaint driven” basis, meaning that the county will not conduct inspections but will investigate calls or e-mails from the public about possible violations.

The measure is the latest attempt by Montgomery to reduce pollution in streams and rivers. In 2011, the council approved a five-cent tax on plastic and paper shopping bags.

The District passed a similar ban last year. With Tuesday’s vote, Montgomery also joins New York City, San Francisco, San Jose and Seattle, as localities that have prohibited the sale or use of plastic foam food service products.