A new study shows that online friendships aren't necessarily a good substitute for the real thing.

If you’re feeling lonely, seeking out friendships online won’t necessarily help you feel closer or more connected to people. According to a new study, the more time young adults spend on social media, the more likely they are to feel socially isolated.

That’s not exactly what the study authors thought they’d find when they began their research. “We really did expect that social media would provide at least some benefit,” says lead author Brian A. Primack, M.D., director of the University of Pittsburgh’s Center for Research on Media, Technology and Health. “After all, that’s the whole purpose of it—that’s why it’s called social media.”

The study, published today in the American Journal of Preventive Medicine, asked 1,787 U.S. adults about how often they used 11 of the most popular social media platforms, including Facebook, Twitter, Instagram, and Snapchat. The participants, all in the 19-to-32 “millennial” age group, were also asked about their mental and emotional health.

Even when the researchers controlled for factors such as relationship status and education level, they found that people who used social media more than two hours a day were twice as likely, compared to those who used less than 30 minutes, to feel socially isolated. And those who used social media platforms 58 or more times per week were three times as likely to feel isolated than those who visited fewer than nine times.

The study was not able to determine a cause-and-effect relationship between social media use and real-life isolation, and the researchers say it’s likely that people who are already feeling lonely turn to these platforms in the hopes of increasing their social circles. “But if that’s true, the results of this study suggest that this quote-unquote self-medication process doesn’t really seem to be working so well,” says Primack.

Primack offers a few other potential explanations, as well. “It may be that people who use a lot of social media don’t have as much time for what would have been more fulfilling direct social experiences,” he says. “Or maybe people who use social media a lot tend to feel like everyone else is more strongly connected than they are—they see other people getting more messages or more likes, and they feel left out.”

But regardless of which came first—loneliness or social-media use—Primack says the new study should provide a “cautionary tale” to social media users, concerned parents, and medical professionals.

“We’re not advocating that everyone get rid of all social media, and we realize that in today’s world it is a very valuable tool,” he says. “We don’t have a lot of broad recommendations, except that people reflect on their own social media use and make sure the way they’re using it to make their lives better instead of inadvertently detracting from it.”

Previous analyses of the same group of study participants have also found that high levels of social media use are also associated with depression and sleep problems.

As a follow-up, Primack is now studying exactly how people utilize social media—if, for example, they use it to connect with people they’ll later spend time with offline. “We do suspect that there are going to be differences in people who use social media as an end in itself, versus those who use it as a tool to leverage the real, in-person relationships they already have.”