Everyone knows how it feels to waste precious nighttime hours on Facebook and become too tired to interact with actual people the next day. New research from the University of California, Berkeley sheds light on that phenomenon, showing that sleeplessness might be even more detrimental to your social life than it already seems. Sleep deprivation, it seems, can create a cycle of loneliness that only gets worse as individuals alienate the people around them.

The team’s results, published in Nature Communications on Tuesday, began as a standard fMRI brain scanning experiment on 18 participants that had pulled an all nighter. The team wanted to characterize how social interactions change when people are sleep deprived: Do they reach out, eager for the comfort of a friend, or turn away and retreat to into their holes? “I think what’s counterintuitive is that when you lack sleep you might want more protection from society or be socially connected,” neuroscience post-doc Eti Ben-Simon, Ph.D., who co-authored the study with senior author Matthew Walker, Ph.D., tells Inverse. “Instead, we want to curl up into our nest, withdraw from society, and go to sleep.”

Over the course of several experiments, Ben-Simon showed that this tendency has some dire social consequences.

Phase One: The Panic Button

In the first part of the experiment, participants watched video clips of a stranger walking toward them with a “neutral expression.” If the stranger got too close, they had the option to hit a “panic button.” When people were sleep deprived, they hit the button earlier — in some cases 60 percent earlier than they did when they had slept through the night.

Sleep deprivation created different patterns in two neural networks that. combined, made people want to withdraw from one another 

With these observations in mind, Ben-Simon and her colleagues turned to the fMRI scans, which showed changes in blood flow due to activity, to understand which regions of the brain were linked to antisocial button-pushing. She noticed a stark pattern: One neural circuit known as the “near space network” showed a ton of activity, while another called the “theory of mind network” was absolutely silent.

The near space network is known for being spatially oriented. It’s what makes you want to dive out of the way of a rogue fly ball or put your hands up if someone invades your personal space. In contrast, the theory of mind network is what helps you infer what other people’s intentions are. As Ben-Simon’s experiments showed, when we’re sleep deprived, we lose the ability to run this high-energy circuit and thus less keen on interacting with others.

“Losing that and having the network shut down without sleep means we are less able to understand the motives of others,” she explains. “Obviously that would lead us to less motivation to try to connect with them.”

The Tables Turn

To round out her experiment, Ben-Simon switched the scripts on her study participants by recruiting 1,000 new online participants to judge recordings of the original participants after they had pulled their all-nighters. These new online viewer watched videos of the sleep-deprived cohort and rated how lonely and “socially desirable” they looked. Not only did the new participants think the sleep-deprived old participants seemed lonely; they also didn’t want to hang out with them.

“I think it’s interesting that we’re less likely to want to interact with someone if they’re lonely,” she says. “If we think about that, we are maybe more suspicious of their social skills. I think we view loneliness as a social defeat, and you try to keep away.”

What the second half of the experiment ultimately revealed is that sleeplessness spurs a vicious, self-sustaining cycle of loneliness. Sleep deprivation makes people withdraw from others because their brains tell them that others can’t be trusted. Meanwhile, other people mistrust lonely individuals for withdrawing in the first place. The study authors call this a “behavioral profile of social withdrawal and loneliness.”

“Instead I think it goes back to what Dr. Walker always says: We’re the only species that intentionally sleep-deprive ourselves, so there’s no evolutionary safety net,” she explains. “Society and our brains are not equipped to see it as a weakness.”

In short, when we should be embracing others who are withdrawing, humans naturally tend to isolate them more. The study’s findings function as a much-needed reminder: Perhaps what we see as a dangerous threat should really be seen as a cry for help.