Summer has arrived, and humans across the northern hemisphere are engaged in one of our species’ favorite pastimes: cursing the heat and the sweaty, sticky bodies that are the inevitable consequence of it.

The feeling of being drenched in sweat is uncomfortable, but the alternative isn’t really great — without a way to cool off, humans would overheat and die pretty quickly in a heat wave. The funny thing about sweating to stay cool is that very few animals do it.

In fact, sweat is an astonishing evolutionary technology. It might even explain how humans went from a band of ragged apes in the woods to the planet’s most dominant and most destructive species.

Hypotheses about how human ancestors went from forest creatures to naked, upright, big-brained animals are hard to test, but here’s a compelling theory: The evolutionary wheels were set in motion millions of years ago by climate change that turned the woodlands of Africa into wide open savannahs. The loss of habitat was a blow to early hominids, but also an opportunity for those who could access a new source of food: red meat.

There's good evidence that Australopithecus afarensis walked on two feet more than three million years ago, before the evolution of big hominid brains.

There were plenty of ungulates (hoofed animals) roaming the grasslands, but catching one was a tricky proposition. Hominids, after all, are not terribly fast runners. Some research suggests that humans simultaneously evolved a few traits around this time: walking on two feet, sweating profusely, and hairless skin. But why? The combination of the features, it turns out, make up an efficient internal air conditioning system that allowed humans to run — not faster — but farther than their prey.

Animals that run on four legs synch up their breath rate with their running pace, because they can only take in air when their diaphragm isn’t compressed by the action of their gait. They can run fast for a while, but eventually they’ll have to stop and catch their breath. This is doubly true if they are relying on panting to cool down — since they cannot pant and run at the same time, if their bodies overheat, they have no choice but to stop running.

When humans began to run upright, they liberated their breath rate from their gait, allowing them to run longer distances without running out of oxygen. At the same time, cooling functions were outsourced to sweat glands, and losing all that fur made sweating to cool down more efficient. Some hominids figured out what we now call persistence hunting — tracking an animal over very long distances until it collapses, overheated and exhausted, allowing for the slower predator to go in for the kill. Although it’s rare today, some African tribes still practice persistence hunting, and there’s evidence it’s been used in cultures around the globe.

Figuring out how to exhaust an antelope, even if it requires a marathon’s worth of running, turned out to be an exceptional evolutionary advantage. Eating meat, and learning to cook it, was a crucial precursor to developing the big brains that allow humans to do things like publish academic articles that consider the question of how we became so smart.

The ironic twist in this story is that, with their big brains, humans figured out how to find and extract oil from the ground in order make all sorts of amazing things that make our lives easier and more enjoyable. The side effect of this astonishing feat is that the planet is now cooking under a blanket of carbon dioxide, getting warmer every year. While humans have both the internal and external technologies to deal with increasing heat, most animals do not. So while only humans are responsible for the climate change mess, it’s the rest of Earth’s creatures that will disproportionately suffer the consequences.

Our sweaty bodies and large heads can do some pretty cool tricks, but as a group, we’re still basically a bunch of assholes.