As they develop into adults, the pupae shuttle milkweed toxin from their guts to their new wings. After emerging from the chrysalis, the monarchs become flying poison. Birds that try to eat the insects vomit them back up.

To understand how monarchs evolved this adaptation, Dr. Dobler and her colleagues took advantage of the fact that other insect species also have evolved a resistance to cardiac glycosides. A few even eat milkweed.

The researchers compared the genes that serve as blueprints for the sodium pump in poison-resistant species, like the milkweed beetle and the milkweed bug. Most of these species, it turned out, had gained the same three mutations.

But the mutations did not pop up all at once. Instead, they arose one after another.

Monarchs share one of the mutations with a related butterfly that doesn’t eat milkweed, and a second mutation with a closer relative that eats milkweed but doesn’t store cardiac glycosides in its wings. The third mutation arose in an even more recent ancestor.

Gaining these mutations gradually altered the sodium pumps in the monarchs’ cells, Dr. Dobler suspected, so that the cardiac glycosides couldn’t disrupt them. As the butterflies became more resistant, they were able to enjoy a new supply of food untouched by most other insects.