Smith Collection / Gado / Getty

It’s pretty hard to catch single-celled organisms in the middle of sex.

“It’s sort of like if you put a male and a female together in the zoo. You can’t necessarily get them to do the thing,” John Logsdon, an early-eukaryotic-sex expert at the University of Iowa, told me. “If you were a Martian looking down on Earth and asking if humans were sexual or not, if you couldn’t look through the windows, you’d never see humans having sex. Well, rarely.”

Lots of single-celled creatures can reproduce both asexually (cloning themselves) and sexually (combining DNA with another organism to create offspring), and they generally prefer cloning.

Really, it’s very strange that anything would have sex at all. Having sex puts organisms in a vulnerable position. Plus, they spend tons of energy attracting mates and going through the complicated process of mixing their DNA with someone else’s.

Cloning is much simpler, and for a long time, many scientists thought the common ancestor of all eukaryotes—the branch of life that includes animals, plants, fungi, slime mold, and everything else besides bacteria and the small, strange archaea—took that route. But, Logsdon said, “our knowledge there was not super great.” Once biologists started examining different eukaryotic organisms to figure out how sex originated, they were surprised by what they found. Even those ancient eukaryotes did it, they now think. The basic elements of sex—attraction and the exchange of genetic material—are far, far older than the evolution of sexes and the familiar equation of man + woman = baby.

“Males and females didn’t evolve until very, very late in the game,” Sarah Otto, a zoologist at the University of British Columbia, told me. If sex and attraction are so much older than males and females, attraction has to be about more than sexual differentiation and gender.

When Logsdon first started thinking about how to imagine ancient-eukaryote sex in the early 2000s, he had an idea: Since plenty of single-celled eukaryotes reproduce without mating, he could look at their genes to find out which ones did reproduce sexually. He assumed that some would have the genes for sex, and some wouldn’t.

But Logsdon discovered something unexpected: All the eukaryotes he looked at had the genes for sex. Not all of them used them, but they all had them. This means that the last eukaryotic common ancestor, or LECA, the ancient predecessor of everything from humans to slime mold, must have been sexual.

So what did attraction and sex look like for LECAs?

“The fossil record for these creatures basically doesn’t exist,” Joseph Heitman, a microbiologist at Duke University, told me. “What we know comes from looking at DNA from existing organisms and tracing back.” But if you grill a bunch of scientists on microorganism sex, you end up with something like this possible reality:

It’s 2 billion years ago. A lonely LECA swims through a crowded ocean.

“Imagine being in a huge sea, surrounded by other species, with no potential mates in sight,” Otto said.

Suddenly, another LECA swims by and notices the first. The courtship begins.

“Even for them, sexiness mattered, and they invested substantial energy in being attractive,” Otto said. “No makeup was involved, but perfumes were.”

LECAs couldn’t see or hear. But they could smell. Their perfumes were pheromones—chemicals many organisms send out as signals to other creatures. These can be incredibly strong; moths can detect each other’s pheromones from miles away, Duncan Greig, a yeast-sex expert at the University College London, told me. LECAs would have seduced one another with pheromones.

“They’re kind of waving to each other. It’s courtship, in a way,” Greig said.

The pheromones tell LECAs they’re the same species. In a sea full of bacteria and archaea, LECAs didn’t want to flirt with the wrong single-celled creature.

But not all perfumes are created equal. Organisms that send out more pheromones are more attractive. After all, putting tons of energy into producing pheromones shows strength.

“It’s rather like knights competing for the favor of some princess,” Greig added.

It works. The LECAs are smitten. So they go through meiosis, giving birth to little clones with only half the DNA of an adult. These newborn half-LECAs swim toward one another, then circle each other. When they get close enough, one shoots out a handle, called a shmoo in modern-day fungi. This was named after a lumpy 1940s cartoon character that happened to resemble these appendages.

The other LECA shoots out its own shmoo. The handles touch, and their membranes merge. Together, the two LECAs look like a cartoon bone.

“They weren’t sperm and eggs. They were just two uniting cells,” Otto explained.

Once their membranes merge, the two cells are a lot like one big cell. Their nuclei float together and merge too. Their DNA mixes together.

“It’s like shuffling two decks of cards,” Logsdon said. “Actually, that doesn’t work, because both decks are the same. Maybe think of it as a deck of Pokémon cards.” Humans still do this—when a sperm and an egg mate, their membranes and nuclei both merge.

Once the LECA half cells mix their DNA together, they become one whole LECA cell. A child is born.

Two billion years later, all eukaryotes have the genes to shuffle their decks. But some organisms are sexual, others are asexual, and some switch back and forth. Many organisms, like most plants, are both male and female. Some species have no sexes, just cells that come together and merge. Some fungi are reported to have tens of thousands of sexes.

“Once you stand back and see the full diversity of ways that organisms reproduce, it makes you realize that the stereotypical view of sex we have involving males and females is just one slice of the pie,” Otto said.

When sexual differentiation evolved later, it didn’t start with two distinct sexes. Instead, single-celled organisms would have developed markers to let each other know they were different types. There might have been an “A” type and an otherwise perfectly identical “B” type that would mate with each other. Or perhaps there were dozens or even hundreds of different types. The idea here was to avoid mating with your close relatives—if your family was all “A,” you might only mate with “B” or “K” types.

Actual sexes evolved later out of the types. But sexes are still not the only way to go about sex and attraction. Even today, in many species, “attraction is still really critical, but it’s not about males attracting females or females attracting males,” Otto said. “On almost any dimension you look at, there’s variation.”

Humans aren’t exempt from this variety, she added. “We imagine sexes as being these two categories, but sex is more fluid and multidimensional than that,” Otto said. “Shoehorning us into two categories is not something evolution tends to do.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.