The next time you find yourself lost in thought while gazing at a fireplace ablaze or even a solitary candle flame, consider this: Being mesmerized by fire might have sparked the evolution of the human mind.

It’s well-known that fire enabled the survival of early humans by providing warmth as well as a means to cook food and forge better weapons. Yet research into cognitive evolution—a field of study that brings together psychology, anthropology, neuroscience and genetics—suggests that fire’s most lasting impact was how our responses to it altered our brains, helping endow us with capabilities such as long-term memory and problem-solving.

Archaeological evidence suggests that the controlled use of fire began with Homo erectus, who emerged nearly two million years ago. For those early hominids, a fire at night served as a light source and a way to deter predators. John Gowlett, a University of Liverpool ar­chaeologist, argues that this innovation led to a profound change in how our brains regulate time. After the sun goes down, our ape cousins spend the entire evening asleep or inactive in nests. But the creation of artificial daylight enabled the hominid brain to adapt and evolve to the point where humans now remain alert and active for over 16 hours a day.

Psychologist Frederick L. Coolidge of the University of Colorado further argues that fire altered the quality of sleep. During rapid eye movement (REM) sleep, the most vivid dreaming occurs and the brain consolidates long-term “procedural memories,” which allow us to retain skills and repeat previously learned tasks. The downside is that REM sleep is accompanied by a form of near paralysis known as muscle atonia—not the state you want to be in if you’re surrounded by animals that want to eat you. Using fire to keep predators away would have made it safe for early hominids to indulge in more REM (modern humans spend 25 percent of sleep in REM, compared with up to 15 percent for apes and monkeys), improving their ability to learn multistep tasks such as tool manufacturing.

Fire might also have improved our ability to think about many things at once and relate them to one another. This “working memory” is an essential trait for imagining and executing complicated plans. Psychologist Matt Rossano of Southeastern Louisiana University speculates that small social groups first achieved this altered mental state some 100,000 years ago around the campfire.

Focusing on a specific object—in this case, fire—is a way to achieve a meditative state. The brain regions that activate to trigger meditation overlap extensively with the regions governing working memory. And, since meditation also has benefits for health, Rossano proposes that evolution would have favored those who were good meditators, allowing them to pass their ability along to their progeny.

By regulating attention, our ancestors were able to make contingency plans—in which alternative responses to problems were planned in advance. These attributes gave us a marked advantage in the face of competition from archaic humans such as Neanderthals; they also underpin our ability to cope with the huge variety of tasks required by modern life. The most enduring tool that fire ever made might just be the human mind.