When monarch butterflies wing their way south to central Mexico each fall, they use the sun to ensure that they stay on course. But how they head in the right direction on cloudy days has been a mystery—until now.

It turns out they use Earth's magnetic field as a kind of backup navigational system.

It's not unusual for animals engaged in long-distance migrations, including sea turtles and birds, to use an internal magnetic compass to get to where they're going. But whether monarch butterflies have a similar ability had previously been unclear: Some studies had found weak evidence for a magnetic compass, while others found none at all. (Read about other great animal migrations.)

A paper published today in the journal Nature Communications finally puts the issue to rest: The famous black-and-orange butterflies do, in fact, pack a magnetic compass.

(Researchers also found the reason for the past conflicting evidence: The insects need ultraviolet [UV] light, which can penetrate cloud cover just fine, to power their magnetic compass—and some of the previous studies didn't provide the requisite illumination.)

Light-sensitive molecules called cryptochromes can detect small changes in Earth's magnetic field, says study co-author Steven Reppert, a neurobiologist at the University of Massachusetts Medical School in Worcester. And the cryptochromes in monarch butterflies need light on the UV-A side of the spectrum to operate.

Earth's magnetic field lines radiate out from the South Pole, loop up around the Earth, and reenter the planet at the North Pole, Reppert says. That means there's a gradient in the magnetic field from pole to equator.

When Reppert and colleagues put monarch butterflies in a flight simulator and manipulated the magnetic field and light levels, they found that the butterflies used changes in the magnetic field to orient themselves, rather than relying on the location of the North or South Pole. (See: "Migrating Monarch Butterflies in 'Grave Danger,' Hit New Low.")

"The dominant compass system [in monarch butterflies] is the sun compass," says Reppert. But their magnetic compass is a good backup system, since there are bound to be overcast skies on the way to their overwintering grounds. (Related: "Cracking Mystery Reveals How Electronics Affect Bird Migration.")

Whether monarchs have a "magnetic map sense"—or the ability to know where they are in relation to their destination based on geomagnetic coordinates—remains to be seen.

"It's a possibility which we're about to explore," Reppert says.