Evolution is a work in progress, so it’s hardly surprising that some of the features it has built into the human body are still far from optimal. And of all those features, one of the hardest to explain is also one of the most conspicuous: external testicles.

From an evolutionary standpoint, after all, testicles are the most important thing about a man — without them, he wouldn’t exist at all. And there they are, just sitting out in the open. Exposed. Vulnerable. What kind of design is this?

Of course, there is an explanation. Human sperm cells develop better at a slightly lower temperature than the rest of our body seems to prefer. Humans aren’t alone in this respect: Most male mammals have testicles that migrate through the inguinal canal during gestation or infancy and eventually take up residence outside the abdominal cavity, suspended in a temperature-sensitive adjustable hammock. This allows the sperm cells to develop at the temperature that’s just right.

But is it really just right? Only if you accept that the ideal temperature is a special fixed property of the universe, like Planck’s constant or the speed of light in a vacuum. Evolution could have simply tweaked the parameters of sperm development so the ideal temperature of its enzymatic and cellular processes was the same as the rest of the body’s processes. Hematopoiesis, the creation of new blood cells, is a close parallel of sperm development in terms of the tissue architecture and cellular events involved, yet bone marrow doesn’t grow outside our body. Nor do ovaries, for that matter.

The fact is that there is no good reason that sperm development has to work best at lower temperatures. It’s just a fluke, an example of poor design. If nature had an intelligent designer, he or she would have a lot to answer for. But since natural selection and other evolutionary forces are the true designers of our bodies, there is no one to question about this. We must interrogate ourselves: Why are we like this?

The so-called “argument from poor design” goes back to Darwin himself. Prior to evolutionary theory, most people, scientists included, considered the world and everything in it to be the flawless creation of a perfect God. Of course, the rampant imperfections we can all easily spot called out for explanation and usually invoked a response along the lines of a “fall from grace” or some other such hand-waving. Now that we know that evolution is the creative force of life, we can be free from the expectation of perfection.

But we’re not. Far too often we repeat refrains like “Well, it must do something important or natural selection would have eliminated it,” or “Living things are perfectly suited for their habitats,” or “Evolution doesn’t tolerate inefficiency.” We haven’t really moved on from the creationist mindset that expects to see perfection in nature.

The reality is that evolution is aimless, natural selection is clumsy, and there’s no such thing as being perfectly adapted. Our bodies are a mishmash of compromises forged in different eras and by survival forces very different from the ones we now face. Evolution can work only with the bodies that we have, as they are, and can achieve “progress” only through the slightest tweaks and tugs. Even more frustrating, the selective forces themselves are constantly changing due to the dynamic nature of environments and ecosystems.

When choosing male sexual partners, female chimps prefer those with large testicles. Why? Visual: Tony Margiocchi/Barcroft Media via Getty Images

External testicles are just such an example. There are competing theories on how this strange quirk came about. Perhaps the testicles were escaping the newly warming abdomen of early mammals. There are other, more esoteric hypotheses as well, none of them perfectly satisfying, all of them potentially contributing a kernel of truth. In the end, it doesn’t really make sense, but, well, there they are.

In addition to the obvious danger of designing such important organs without any protection or even padding, external testicles introduce additional problems for mammals. One in four men will develop a hernia in their groin, 10 times the rate of women, precisely because of a weakness in the abdominal wall left from the migration of the testicles out of the abdomen. Surgical repair is relatively straightforward, but surgery is a relatively new invention in the history of our species. While only a small percentage of these hernias become life-threatening, given how common they are, hernias have killed untold millions over the ages.

The interesting evolutionary questions don’t end with the origin of external testicles. How they got there is one question; what has happened since they got there is another, and we can actually get some answers to that question. While lots of physical variation is selectively neutral, there is reason to believe that conspicuous testicles served additional purposes for their bearers. Perhaps there was a sexual selective advantage in advertising testicles prominently, especially in creatures for whom sperm competition is important. If you got ’em, flaunt ’em.

While humans have relatively modest testicles, our closest relatives, the chimpanzees, harbor comparatively enormous ones, around three times the size of ours even though our overall body weight is similar. What does this tell us? Perhaps the large testicles indicate that male chimpanzees engage in sperm competition, in which the males who create and deposit the most sperm are rewarded with the most offspring. But sperm competition would exist only if the chimps, particularly the females, have sex with multiple partners. In a monogamous arrangement, there would be no advantage in having big testicles and lots of sperm.

And biologists have noticed that when choosing male sexual partners, female chimps prefer those with large testicles. Why? If we assume that testicle size is at least partially controlled by genetics, the female’s reproductive choices influence the traits of the children she will bear, including their genitals. If she chooses a mate with big balls, her sons will have big balls, and if big balls help him have more offspring, she’ll get more grandchildren. It is therefore in her reproductive interest to pursue attractive mates, because they’ll lead to attractive children, and that will boost her genetic legacy. This is known as the “sexy son” hypothesis.

Of course, human testicles are just one glaring example of the quirks that demonstrate how imperfect evolution can be. No sane engineer would design a body withsuch a bent back, weak knees, and nasal sinuses that have to drain upward. We fail at synthesizing basic vitamins, our immune cells frequently attack our own bodies, and our DNA is mostly gobbledygook. This is not good design.

While the flaws themselves demonstrate the random, haphazard way that evolution works, even more interesting are the backstories of each flaw. We don’t make vitamin C because a primate ancestor already had plenty of it served up right there in its environment. Our sinuses are a mess because evolution smooshed the snouts of monkeys into a more flattened face than other mammals — and then, for reasons we don’t fully understand, humans developed still flatter and smaller faces.

These are not simply obscure academic issues. Our inability to make vitamin C caused the death of millions of our forebears from scurvy. Poor drainage in our meandering sinuses causes frequent and painful infections. We are evolved to survive and reproduce, but not necessarily to be healthy, comfortable, or happy.

Even our powerful minds, supposedly our crowning achievement, are anything but perfect. The biggest threats we now face are purely of our making. Because evolution does not make long-term plans, neither do we: We jump to conclusions, think only of the short term, ignore evidence we don’t like, and fear and despise those who are different from us. And unlike external testicles, which are merely inconvenient, these are flaws that could one day prove fatal to our imperfect species.

Nathan H. Lents is professor of biology and director of the Macaulay Honors College at John Jay College, part of the City University of New York. He maintains the Human Evolution Blog, writes for Psychology Today, and hosts the podcast “This World of Humans.” Besides his new book, he is the author of “Not So Different: Finding Human Nature in Animals.”