Millions and millions of years ago, apes survived on sugar-rich fruit. These animals evolved to like riper fruit because it had a higher sugar content than unripe fruit and therefore supplied more energy.
"Sugar is a deep, deep ancient craving," said Daniel Lieberman, an evolutionary biologist at Harvard University and author of "The Story the Human Body: Evolution, Health, and Disease."
And sugar offers more than just energy - it helps us store fat, too.
When we eat table sugar, our bodies break this down into glucose and fructose. Importantly, fructose appears to activate processes in your body that make you want to hold on to fat, explains Richard Johnson, a professor in the department of medicine at the University of Colorado and author of "The Sugar Fix." At a time when food was scarce and meals inconsistent - hunting is significantly less reliable than a drive-through - hanging on to fat was an advantage, not a health risk.
In a forthcoming paper, Johnson postulates that our earliest ancestors went through a period of significant starvation 15 million years ago in a time of global cooling. "During that time," he said, "a mutation occurred" that increased the apelike creatures' sensitivity to fructose so that even small amounts were stored as fat. This adaptation was a survival mechanism: Eat fructose and decrease the likelihood you will starve to death.
The sweet taste was adaptive in other ways as well. In the brain, sugar stimulates the "feel-good" chemical dopamine. This euphoric response makes sense from an evolutionary perspective, since our hunter-gatherer ancestors predisposed to "get hooked" on sugar probably had a better chance of survival (some scientists argue that sugar is an addictive drug).
"Imagine if someone hated sugar in the Paleolithic era," said Lieberman. "Then they wouldn't eat enough sugar or have enough energy and wouldn't have children."
In other words, anything that made people more likely to eat sugar would also make them more likely to survive and pass along their genes.
All the food challenges our prehistoric ancestors faced mean that biologically, we have trained ourselves to crave sweets. The problem today is that humans have too much of the sweet stuff available to them.
"For millions of years, our cravings and digestive systems were exquisitely balanced because sugar was rare," Lieberman wrote in an op-ed for The New York Times. "Apart from honey, most of the foods our hunter-gatherer ancestors ate were no sweeter than a carrot. The invention of farming made starchy foods more abundant, but it wasn't until very recently that technology made pure sugar bountiful."
Weight gain was not a real risk when our instincts meant we might scarf down the nutritional equivalent of a carrot whenever we happened to stumble across one. Drinking soda all day - the contemporary equivalent - is a different story.
Today, the average sugar intake in the U.S. is 22 teaspoons per person per day, which is four times the amount that the World Health Organisation suggests is healthy. Eating too much sugar is linked to a laundry list of negative health effects, including diabetes, obesity, and high blood pressure.
"We need to realise that our bodies are not adapted to the amount of sugar that we are pouring into them and it's making us sick," said Lieberman.