The 3,000-mile migration of monarch butterflies in North America is one of the insect world’s fantastic feats, and a single gene may be the reason they are able to do it.

Scientists studied the complete genetic material, or genome, of monarchs — both those that migrate and those that don’t. They found that a gene related to flight muscle efficiency plays a big role in their migration.

“One gene really stood out from everything else in the genome,” said ecology professor Marcus Kronforst.

It was a gene related to collagen, the main ingredient in connective tissue, that was essential for flight muscle function. The researchers were surprised to find that the gene was less active, not more active, in migratory butterflies. But rather than making them big, powerful fliers, the gene made them efficient. Kronforst said it was like “the difference between marathon runners and sprinters.”

Kronforst suspects this example of divergent selection came about because more efficient flight benefited migrating butterflies, while outsprinting competitors for flowers and mates helped the butterflies that stayed close to home.

The study, published last week in the journal Nature, also identified the gene behind the butterfly’s orange-and-black pattern.

Scientists say the monarch’s orange color — produced by chemicals from the milkweed plants that nourish them when they are larvae — tells potential predators they taste awful and are toxic to eat.