More than half of all sandpits for children and pets tested were swarming with the bacteria Clostridium difficile, also known as C. diff.
And worryingly scientists found genetically diverse strains of C. diff including certain strains displaying increased toxin production, and in some cases multidrug resistance.
C. Diff causes watery diarrhoea, painful tummy cramps, nausea, dehydration, a fever and a loss of appetite and weight.
Serious infections may require surgery to remove a damaged section of the bowel.
The latest finding was over double the amount of found in soil in public parks, gardens, playgrounds and other locations around Cardiff in 1996 where it was found in a fifth of samples.
Professor Prof José Blanco of the Complutense University of Madrid said: "The soil of playgrounds is a reservoir of diverse parasites and infectious agents.
"Furthermore, free access of domestic and wild animals to recreational areas can increase the burden of microbiological contamination.
"Children are generally regarded as the main group at risk for environmental exposure to pathogens, not only because they are frequent users of playgrounds, but also due to the high prevalence of geophagia in that consumption of sand within this group, and the immaturity of their immunological, neurological and digestive systems.
"Clostridium difficile is a Gram-positive, anaerobic bacterium of widespread distribution in the environment, where it can survive under adverse conditions through the production of spores.
"This bacterial species was traditionally regarded as a primarily nosocomial pathogen, but this view has been challenged as the incidence of C. difficile infection (CDI) in people outside hospitals started to increase.
"In this context, diverse animal species, food products and environmental sources have been suggested to play a role in the transmission of the C. difficile and, in particular, of some epidemic genotypes such as ribotype 078.
"However, to the best of our knowledge, the presence of C. difficile in sandboxes of playgrounds has only been explored in a limited number of studies."
So the researchers tested 20 pairs of recreational sandboxes for children and dogs in different playgrounds within Madrid.
Overall, 52.5 per cent or 21out of 40 samples were positive for the presence of C. difficile.
Eight of the 20 available isolates belonged to the toxigenic ribotypes 014 and 106, both regarded as epidemic, and CD047.
Prof Blanco added: "The growing number of pets and other animals leaving excrements in the sandboxes of playgrounds and other recreational areas constitutes
a serious epidemiological threat.
"Current tests for assessing the sanitary conditions of sandboxes focus on detecting some select pathogenic parasites and bacterial indicators of faecal contamination, but mostly neglect the possible presence of other emerging pathogens such as C. difficile.
"In this study, we demonstrated that C. difficile is widely distributed in soils samples from both children's and dog's sandboxes located within the metropolitan area of Madrid.
"Furthermore, our results revealed that recovered isolates were genetically diverse and displayed resistance to several antibiotics, more than two drugs, including in all cases imipenem and levofloxacin.
"Our results are just a call to action.
"Due to the zoonotic potential attributed to some ribotypes of C. difficile, the possible presence of this emerging pathogen should be considered in any environmental risk assessment."
The study was published in the journal Zoonoses and Public Health.