Pools across Spain have had to shut this summer because of the so called "brown challenge," a viral trend in which children and teenagers deliberately defecate in the water and film the scene for clicks on social media. What started as a joke has turned into a public health problem now worrying dozens of town councils.

The trend has spread this summer through Galicia, Valencia, Madrid, Andalusia, La Rioja, Cantabria and Castilla-La Mancha. In Zamora, some municipal pools have had to close as many as six times over the course of the season for this reason, forcing staff to drain and treat the water each time an incident occurs.

Last year saw roughly 300 cases nationwide; this summer, authorities are already describing "hundreds" of additional incidents. Some minors have gone as far as hiding feces in plastic bags inside their swimsuits to fake the act on camera, according to several town councils.

Public health experts warn that feces in pool water can spread bacteria and viruses, including salmonella and the parasite Cryptosporidium, and that swallowing contaminated water can cause stomach pain, vomiting, high fever, dehydration and severe diarrhea.

Fines typically range from 1,000 to 3,000 euros, though some councils have raised penalties as high as 20,000 euros and permanently banned offenders from their facilities. In Picassent, in Valencia province, the town council fined several minors 5,000 euros and took the case to court.

Psychiatrist Andres Lopez attributes the trend's rise to the addictive mechanisms of social media, which he says encourage a bandwagon effect among younger users. Mayors such as Cristina Ayala, in Burgos, have vowed to pursue cases "to the very end" given the economic and health costs of repeated closures.