In recent years, thick layers of cyanobacteria — commonly known as blue-green algae —have closed popular local swimming spots Lake Anza and Lake Temescal for weeks at a time.

Last summer, a toxic algae bloom in the San Francisco Bay killed thousands of fish.

Although algae is always present in some quantity in lakes and the bay, higher temperatures, stagnant water and excessive nutrient levels can cause the algae to multiply.

If the particular species has toxins in it, such as blue-green algae or the Heterosigma akashiwo species that bloomed in the bay last summer, the water can become unsafe for humans and animals.

Algae blooms and cyanobacteria have become state and nationwide problems. In the Bay Area, water managers were beginning to wonder if the extreme drought conditions of recent years had pushed the problem into a dangerous new phase in local waters.

But the steady and sometimes torrential rainfall this winter means that the bay’s waterways could avoid a repeat of last year’s out-of-control toxic blooms.

“Given all the rain and runoff, we’re hopeful we can get through the spring and summer without a massive, harmful bloom,” said Eileen White, an executive officer for the San Francisco Bay Regional Water Quality Control Board. “But we’re kind of in uncharted territory.”

Still, water quality managers recognize that weather is only a temporary solution. Next year could be another wet winter, or the start of a 10-year drought.

And the rain won’t address the region’s long-term problem: too many nutrients in the water.

For freshwater lakes like Lake Anza and Lake Temescal, problems with high water temperatures and nutrients are exacerbated by sediment build-up. When Lake Temescal opened to the public in the 1930s, it was 80 feet deep. Now its deepest point is only 16 feet below the surface.

“There is something like 60 feet of sediment in there,” said Becky Tuden, an ecological services manager at East Bay Regional Parks. “And with sediment comes nutrients.”

In the bay, stormy weather stirs up sediment that makes it harder for algae to photosynthesize. According to the states’ harmful algal bloom report map, there are currently no incidents in the region.

In lakes, however, it’s possible rain may even make the situation worse. Although the lakes have filled with colder water, more sediment has also been deposited throughout the winter. Dredging the lake would cost upwards of $20 million.

Instead, state and regional partners have worked to identify mitigation measures, and they’ve targeted nutrient levels as a primary area in which they can have an impact.

For both Lake Temescal and the San Francisco Bay, releases from wastewater treatment plants are often the primary reason for the higher levels of nutrients. According to both Tuden and White, managing those releases will be a priority moving forward.

“What we learned last summer is that we’ve reached a tipping point,” White said. “I can’t control the sun, can’t control the temperature of the water, can’t control the wind or the amount of runoff. But the one thing we could control is the nutrient loads in the bay.”