The city will move to the forefront of a growing environmental trend by banning food establishments from using plastic foam containers starting this summer, Mayor de Blasio's administration said Thursday.

De Blasio's mayoral ban will fulfill an initiative begun by his predecessor, Michael Bloomberg, who first suggested banning the material in his final State of the City address, in 2013. New York will now be the largest city in the country -- following San Francisco, Seattle and Portland, Oregon -- to prohibit the foam containers, which environmental groups have long decried as a hazard that clogs the nation's landfills.

"These products cause real environmental harm and have no place in New York City," said de Blasio in a statement announcing the ban. "We have better options, better alternatives, and if more cities across the country follow our lead and institute similar bans, those alternatives will soon become more plentiful and will cost less."

Administration officials believe that the ban will remove nearly 30,000 tons of expanded polystyrene from the city's streets, waterways and landfills, and it continues de Blasio's push to create a greener New York City. Last year, he announced an ambitious plan to cut its greenhouse gas emissions 80 percent by 2050 from its 2005 levels.

The ban will take effect July 1. Beginning that day, food establishments — from food carts to Chinese takeout — will not be allowed to use plastic foam cups or containers. Packing peanuts will also not be allowed to be sold within the city, though peanuts can still be placed within packages that are shipped to New York from elsewhere.

"While much of the waste we produce can be recycled or reused, polystyrene foam is not one of those materials," said Sanitation Commissioner Kathryn Garcia. "Removing polystyrene from our waste stream is not only good for a greener, more sustainable New York, but also for the communities who are home to landfills receiving the city's trash."

Administration officials said the ban will have a grace period, without fines, until January 2016.

Nonprofits and businesses with less than $500,000 in annual revenue could qualify for an exemption from the plastic foam ban, but they would have to prove that using nonfoam materials would create financial hardship.