Genitals are among the fastest-evolving features in the animal kingdom. They’re also among the most diverse, arrayed in all shapes and sizes, adorned with spines, hooks and even teeth. Ducks have corkscrew-shaped genitalia. The male seahorse has a brood pouch that receives his mate’s eggs for fertilization and in which he nurtures the resulting offspring until birth. Female cabbage white butterflies have a hinged jaw inside their genital tract. Nature is full of strange reproductive organs with unusual uses. For the most part, though, certain genital morphologies are associated with males, others with females.

But in 2014, a tiny insect called the barklouse broke even that rule when researchers reported that the females of all four species of a genus found in the caves of Brazil had a penis. It didn’t just look like a penis but acted like one, too: a penetrative organ the female insects used to anchor themselves to their mates during copulation. Moreover, complementary changes in the genitalia of the males had left them with a small pumping mechanism inside a membranous “vagina-like” cavity.

The finding not only piqued widespread interest (and amusement — the team was awarded a comedic Ig Nobel Prize in 2017), but also led to a debate about whether the scientists involved were correct to refer to the structure, called a gynosome, as a “female penis.” (Some experts, for instance, disagree with that characterization because the gynosome collects sperm rather than delivering it.)

Now, the story has developed even further: It turns out the gynosome evolved not once, but twice, as described recently in Biology Letters. Evolutionary forces seemed to favor these structures so much that they emerged independently in two lineages of the barklice, the Neotrogla in South America and the Afrotrogla in Africa.

As scientists have sought to gain a better understanding of how the structural reversal arose in these barklice, they’ve had the opportunity to test the universality of sexual selection theory, explore the selection pressures on sex roles and assess the major, often overlooked part that environment and ecology play in the evolution of genitalia. In doing so, they’ve also challenged our conceptions about what it means to be male and what it means to be female, and witnessed just how flexible and innovative nature can be.

The Anatomy of Sexual Selection

In evolutionary terms, it’s gametes, not genitals, that define sex: Males make numerous small, mobile sperm, while females produce a smaller number of larger, far more metabolically expensive eggs. Because of that asymmetry, which leaves females with the more limited reproductive resource, the sexes can find it advantageous to pursue different breeding strategies, and that conflict lays the foundation for sexual selection, an important mode of natural selection. Typically, females will tend to be picky about their mates to avoid wasting precious eggs. Meanwhile, males will try to make themselves appealing — to as many mates as possible — with showy displays (like the male peacock’s tail) or by defeating rivals or offering females “nuptial gifts” of nutrients from their own bodies. Throughout nature, male genitalia also often have structures like spines that can prevent a female from breaking away or a competing male from gaining access to her.

These strategies can be stood on their head, however, when the limiting resource instead lies with the males. In some species of birds, for instance, skewed sex ratios cause females to court multiple males and control territories. Male bush crickets in Australia transfer nutrients to the females during copulation: At times of the year when food availability is more constrained, females court the males; when that’s not the case, traditional sex roles dominate.

But usually those reversals weren’t known to extend to genitalia. That is, they weren’t until the discoveries of Afrotrogla and Neotrogla.

Kazunori Yoshizawa, an entomologist at Hokkaido University in Japan, and Yoshitaka Kamimura, a biologist at Keio University in Japan, along with their colleagues, found in 2014 that when these barklice copulate, the female mounts and penetrates the male with her gynosome, which keeps the pair anchored together during sex that can last up to 70 hours. The semen, which includes sperm and a nuptial gift of concentrated nutrients, is transferred from the male through a duct in the gynosome and into a storage organ. A special switching valve on that organ allows the female to store two nuptial gifts at once.

“When we dissected and observed the female of Neotrogla,” Kamimura wrote in an email, “we all experienced an illusion that ‘we are now observing a male insect.’”

“Pseudopenis” structures on females aren’t unheard of. They’re found among a range of animals, including moles, lemurs, bearcats and spotted hyenas, although only in the last case do they actually resemble the penis of the males of their species. And even then, the structure is actually an enlarged clitoris (the spotted hyena still has a vagina) and isn’t used to penetrate a mate or stimulate sex as penises typically are. For that, only barklice are known to have reversed the way of things, with the gynosome evolving from a very different set of tissues.

The real surprise that emerged in the most recent work was that female penises evolved separately in the Afrotrogla and the Neotrogla. (The paper found that the Afrotrogla were more closely related to another cave insect genus, which had traditional genitalia.) Why would this unusual arrangement evolve twice independently within a fairly small group of insects?

The researchers theorize that a major reason for the cave insects’ sex role reversal is that their habitats are severely lacking in nutrients. To get enough food and water, the only recourse for females is to mate and hoard nuptial gifts. Because they are able to stockpile two nutritional packages at once, competition over males has gotten even more fierce. That, coupled with other factors such as the physical positions in which they copulate, likely drove the females to evolve the gynosome and males to accommodate the new structure by almost entirely losing what was once their penis.

Energy, Ecology and Sex

Although anatomically exceptional, the genitals of Afrotrogla and Neotrogla actually reaffirm what sexual selection theory predicts: Selective pressures will act on the sex that invests less energy into mating and needs access to a limited resource. The emergence of particular genital structures is not unique to one sex or the other, then, but rather a general feature of energy expenditure and evolutionary diversification at work.

“It really challenges our notions about sex,” said Justa Heinen-Kay, an evolutionary ecologist doing postdoctoral work at the University of Minnesota. “Nothing is inherently female or inherently male. It’s all context dependent.”

Diane Kelly, a senior research fellow in behavioral neuroscience at the University of Massachusetts, Amherst, who was not involved in this research, echoed Heinen-Kay’s view. “Animals evolve whatever happens to work,” she said.

Heinen-Kay also noted the broader implications of the discovery. “Both in evolution and in society at large, there’s been a lot of discussion about what is gender, what is sex, what is natural,” she said. “I think studies like these are important for shedding light on these discussions, for showing how diverse nature is and that there’s really not just one way that male and female manifest.”

Those preconceptions have gotten in the way of research on reproductive strategies and genitalia evolution, according to Marie Herberstein, a biologist at Macquarie University in Australia. The assumption that males tend to have more complex genitalia has skewed the focus of work in the field. Starting to pay as much attention to female anatomy, she argues, will reveal new and fascinating truths about nature.

For one, this case has shown just how critically the evolution of genitals can depend on ecological conditions. Not much is known about the topic, and most scientific exploration tends to focus on the interactions between males and females in the context of sexual selection. But that doesn’t give the complete picture. “It’s important to take a step back, to think about the broader environmental context in which these interactions are taking place,” Heinen-Kay said. (Take another recently published finding: In hermit crab species that put more energy into maintaining and “remodeling” their shells, the males evolved longer penises — allowing them to mate without leaving their shells, which might otherwise get stolen by other crabs.) Understanding this can, in turn, provide insights into how the evolutionary forces of survival and reproduction work in tandem, and why animals look and act as they do.

The cave insects from Brazil and Namibia offer a promising place to start looking for answers. Researchers could perform further experiments to figure out the costs and benefits that these morphologies bring to both sexes, as well as to test how certain conditions might affect or reverse sexual behavior (in one species of Neotrogla, for instance, the anatomical reversal seems to have “de-escalated”). The team also plans to study other lineages to get a better handle on the critters’ evolutionary history.

It’s entirely possible that there are more cases like this in nature, waiting to be discovered. “There is so much diversity in these systems,” Kelly said. “There has got to be even weirder stuff out there that we haven’t described yet. And it’s often the weird stuff that tells us things.”

This article was reprinted on WashingtonPost.com.