Last summer, the beaches that ring the port city of Odesa in southern Ukraine were crowded with volunteers packing sandbags under bluffs where troops were positioned in machine gun nests as the threat of a Russian amphibious assault still loomed.

This summer was supposed to be different. In the first days of June, the sun was warm, the Black Sea was a shimmering blue, and many Ukrainians were already packing the beaches despite an official ban on swimming.

Then the Kakhovka dam was destroyed.

It released a torrent of water rushing down the Dnipro River, washing over towns and villages across southern Ukraine. Thousands of houses and businesses were flooded, vast stretches of rich farmland were ravaged, and the full environmental and economic cost is likely to take years to measure.

The floods also carried mountains of debris out to the Black Sea — pieces of buildings, trees, appliances, boats, livestock carcasses and even instruments of war, like the land mines both Russian and Ukrainian forces had planted near the river. Now, the tides are carrying much of that to shore, along with a stew of toxic chemicals, fouling the famed beaches of Odesa and other coastal communities.

“The sea is turning into a garbage dump and animal cemetery,” Ukraine’s border guard agency warned last week. “The consequences of ecocide are terrible.”

It said there was a “plague of dead fish” mixed among the houses and furniture, mines and ammunition washing ashore. On Saturday the Odesa city council declared that swimming at all beaches in the city was banned, calling it “dangerous to the health of citizens.”

Before the dam broke on June 6, city officials were busily installing protective nets in the water to catch drifting naval mines, like the nets that protect swimmers in other parts of the world from sharks. But there is no system that can hold back the deluge of waste now hitting the shores, emergency and military officials said.

In the past few days, mines swept from the Dnipro washed ashore in Odesa, more than 100 miles away, the local branch of the State Emergency Service said. One was found by a resident who thought it was a bottle of cooking gas and picked it up. Somehow, it didn’t explode.

”He brought it home, but then luckily common sense won and he called the de-miners,” the agency said.

The dam’s destruction may mean another summer cut off from the sea, a bitter blow in a city already suffering from periodic Russian missile strikes and the loss of its port, with all but a few grain ships kept from setting sail by a Russian blockade.

Igor Oks, creative director of a new international cultural center in Odesa, said the city without its port was like a body without its limbs. Not being able to enjoy the sea, he said, is like cutting out the heart.

He recalled the scene a year ago, amid fears of a Russian landing, when the beaches were prepared for battle, marked by trenches and steel girders welded into tank traps.

“Everywhere, there were bags of sand, and there were volunteers coming to the beach every day filling these bags,” he said. “I remember going to the beach and seeing the level of sand drop like four or five feet.”

City officials estimated that 700 tons of sand was dug up from the beaches when alarm was at it highest during the first months of the war.

At the time, Odesa still faced a Russian threat from land, air and sea. Now, the Kremlin’s land forces have been pushed back and its warships keep a wary distance as improved Ukrainian coastal defenses have put them at risk.

But the destruction of the dam has brought new dangers, threatening to dampen a revival of life and commerce in a city that has long been a favored escape for people across Ukraine.

With President Vladimir V. Putin’s hopes of seizing the city seemingly well out of reach, Odesans were trying to recover some of the summer sizzle that helped the city earn its reputation as “the pearl of the Black Sea.”

Once a minor outpost of the Ottoman Empire, it was conquered by Russia in the 1790s, re-founded and renamed by Empress Catherine the Great and grew into a wealthy port and resort, known for its beaches and elegant architecture.

In early June, ballerinas from a dance school were holding a class on a boardwalk in the early morning, an outdoor movie theater was set for a summer film festival in the evening and music poured out of the cafes all day.

The famed Potemkin Stairs — 192 steps that lead from the city to the port — are closed off, as the port remains a target of Russian attacks, but most of the checkpoints around the city are gone. The restaurants and bars are crowded, and before the dam broke, workers were busy cleaning the sand on the beaches, not digging it up.

Now, they have to keep pace with a flood of often dangerous debris.

Mykola Kaskov, 47, chief of the rescue diving unit of the State Emergency Service in the Odesa region, said that even before the dam broke, maritime mines loosed from their moorings presented a lingering risk. But his mission remains the same.

“The main thing is to keep people alive,” he said.

There was a ban on swimming last summer, but mines still killed several people at the beaches. A 50-year-old man who entered the waters searching for sea snails, an Odesan delicacy, was blown up last June as his family watched from the shore.

A month later, a young man went for a swim and “was blown up by a mine on his birthday,” Serhii Bratchuk, spokesman for the Odesa Military Administration, said at the time.

That danger is now far greater, the Ukrainian military southern command warned.

Yevhen Koretskyi, 24, a demining specialist for the State Emergency Service in the Odesa region, has been training on a new underwater drone designed to search for explosives. They received the new equipment only days before the dam burst, but are already putting it to use.

Demonstrating the equipment at an empty marina on the city’s outskirts, he said that he and his colleagues would soon employ such devices to help protect swimmers in the sea, as well as in the recently flooded rivers and lakes.

Viktor Butenko, 41, a rescue diver, was testing a different device nearby that would need to be used if they arrived too late.

“This catamaran drone is for searching for bodies,” he said.

Before the dam’s destruction, many Odesans said they ready to dip their toes back into the water, despite the dangers, though some more cautiously than others.

Olena, 40, who was at the beach with her 7-year-old son in early June, said that she was approaching the sea “gradually.”

“I first came to the sea walk,” she said, referring to the paved path beyond the sand. “Then to the beach, and finally tried the sea.”

“I haven’t bathed yet, too cold for me, but my son goes into the water,” she added. “Of course, we are afraid of the mines, but it’s the time for summer vacation and it would be too sad without the sea.”

Now there are more mines, and other threats, as well. The sea, officials said, is once again too dangerous to enter and it looks like another beach summer could well be lost to the war.

Anna Lukinova and Evelina Riabenko contributed reporting.