Over the holiday weekend, many people looking to cool off from the summer heat were disappointed as some beaches were closed or authorities advised against swimming because of unsafe levels of bacteria.

The advisories and closures popped up across the East Coast, from Florida to Maine, along inland streams and rivers, and were present throughout the California coast. The culprit: Fecal contamination detected in the water, presenting a risk of illness.

For decades, beaches across the country have seen days, weeks and months of closures because of elevated levels of fecal bacteria, according to the Environmental Protection Agency. A recent report from the conservation group Environment America found that last year, 61% of beaches it tested nationwide had one day where bacteria levels were potentially unsafe.

More: Beaches across US close during Labor Day weekend due to fecal contamination

But what is causing the heightened contamination levels?