New research suggests that whenever species evolve to feed at different depths, their courtship evolves as well.

Researchers found that in the shallows where the light is good, males build sand castles to attract females. Males of deep-dwelling species dig less elaborate pits and compensate with longer swimming displays. The results are published in the open-access journal Frontiers in Ecology and Evolution.

"Lake Malawi cichlids are famous for the diversity and fast evolution of their feeding habits, body form, and sex determination system," Ryan York, a graduate student at Stanford University and lead author of the study, said in a statement. "Here we show for the first time that their courtship rituals also evolve exceptionally fast."

For the study, researchers made a DNA-based "family tree" for 75 species (out of more than 500) of Lake Malawi cichlids, noting for each whether males build castles or dig pits. The tree looks like a messy patchwork: the closest relatives of species with castle-building males often have pit-digging males, and vice versa.

They conclude that individual species have repeatedly moved back and forth between castle building and pit digging during cichlid evolution.

Lake Malawi is approximately 5 million years old, which means that all evolutionary changes in the cichlids' ecology -- including courtship behavior -- have happened within this extremely short period.

The evolution of cichlid courtship seems to be driven by shifts in the average depth at which each species feeds. Castles require more effort to build but are more striking to females in clear, shallow waters. In species that live at greater depth where light is scarce, castle building does not pay off.

The findings are detailed in the open-access journal Frontiers in Ecology and Evolution.