Every morning, they rise to the surface of the water; every evening, they sink back down to the lakebed. Now scientists have finally figured out how these green spheres - called marimo algae - perform their dance every single day.

You may have seen pictures of marimo. It's bizarrely adorable - like little fuzzy balls of green moss. In fact, one of its common names is "moss ball", although technically it's not a moss at all.

Instead, it's an aquatic green algae named Aegagropila linnaei. This species usually floats around as threads or filaments; like other types of algae, it is carried around by water, or coats rocks, thriving in low light conditions.

However, in some locations around the world - notably shallow lakes of Japan and Iceland, where it is a protected species - it will tangle into clumps that sink to the lakebed, where the movement of the water rolls the algae filaments into balls.

(In fact, these balls are so beloved in Japan that they have a three-day annual festival to celebrate them.)

This is all pretty straightforward, but the floating at dawn and sinking at dusk behaviour had scientists baffled. Biologists from the University of Bristol thought it might have something to do with photosynthesis, so they decided to put their hypothesis to the test.

When these algae balls photosynthesise, they produce tiny bubbles of oxygen, which become trapped in their fine filaments. So, the researchers thought the bubbles must be what makes the balls float.

To test this idea, they grew some marimo in a laboratory, and coated them in a chemical that inhibits photosynthesis. Sure enough, these marimo did not produce any bubbles - and remained motionless at the bottom of their containers, compared to the untreated control group, which floated normally.

But, as it turns out, the bubbles are only one part of their clever floating mechanism. Somehow, these algae also appear to have a circadian rhythm.

After testing the bubble hypothesis, the researchers kept untreated marimo - one that's able to photosynthesise - for several days under a dim red light.

When they shone a bright light on these balls at different times of day, a new result emerged. They algae spheres floated to the surface much more quickly if the bright light coincided with normal sunrise time, as opposed to other times of the day.

This indicates that the balls' floating and sinking is controlled both by photosynthesis and circadian rhythms - a finding that may aid conservation efforts in the future as the algae mysteriously declines.

"Unfortunately, marimo balls are endangered, being currently found in only half the lakes where they were once spotted," explained biologist Dora Cano-Ramirez of the University of Bristol.

"This might be caused by changes in light penetration due to pollution. By understanding the responses to environmental cues and how the circadian clock controls floating, we hope to contribute to its conservation and reintroduction in other countries."

The team's research has been published in the journal Current Biology.