“As everyone knows, depressed people are some of the most boring people in the world,” Mindy Kaling writes in her book Is Everyone Hanging Out Without Me? “I know this because when I was depressed, people fled. Except my best friends.”

In a section titled “Best Friend Rights and Responsibilities,” she vows, “If you’re depressed, I will be there for you … I will be there for you during your horrible break-up, or getting fired from your job, or if you’re just having a bad couple of months or year. I will hate it and find you really tedious, but I promise I won’t abandon you.”

Having a relationship with someone who’s depressed can be difficult. It’s hard to hear a friend say negative things about herself; it’s hard to know how to help. These are among the more noble reasons people might have—or they may just not want to be brought down themselves by spending time with someone who’s depressed.

There’s an idea out there that you can “catch” depression, that it’s contagious. (One self-help book unequivocally declares in its title that Depression Is Contagious.) Some research supports this idea—one study found that depressive symptoms tended to appear in clusters in social networks, and another found depressive thought patterns spread between college roommates (though positive thinking spread as well).

But a new study published in Proceedings of the Royal Society B challenges that notion. Depression doesn’t spread, it found, but a healthy mood does. The researchers looked at data from more than 2,000 high-school students who took a survey of depression symptoms, and who also reported who their friends were, over a period of six to 12 months. Kids who initially scored as clinically depressed did not “infect” their friends, but if they had enough friends who had what the study called a “healthy mood” (in that they didn’t meet the criteria for depression), that doubled their chances of recovering from their depression. And for people who weren’t depressed in the first place, having enough mentally healthy friends halved their chances of developing depression.

That’s a pretty large effect, and supports previous research saying that high-quality social relationships lower people’s risk of depression.

Thomas House, one of the study authors and a senior lecturer in applied mathematics at the University of Manchester, says he believes this model has an advantage over the studies that find clusters. When you find clusters of friends who are depressed, it’s possible there’s a third factor at play—maybe “they're all heavily drinking or they’re all doing something else that makes them more predisposed to depression,” House says. “Our method wasn't susceptible to that because we looked at direct changes of state. We were pretty much directly observing this process of your friend influencing you. And the nice conclusion that we got was that your friends can protect you from depression and help you recover from it.”

That’s if mentally healthy people are there for their depressed friends, which could be easier said than done. Even if you can’t actually catch depression, that’s not to say spending time with a depressed friend doesn’t take its toll. As the cartoonist Allie Brosh, of the site Hyperbole and a Half, wrote in her astute comic about depression, “It's weird for people who still have feelings to be around depressed people. They try to help you have feelings again so things can go back to normal, and it's frustrating for them when that doesn't happen.”

“We’re not saying you have no negative effect on your friends’ mood but just that it’s not enough to push them into really full clinical depression,” House says.

And people suffering from depression may be inclined to withdraw anyway, to retreat and ruminate alone. That can be exacerbated by their friends’ misguided attempts to cheer them up.

“People want to help,” Brosh writes. “So they try harder to make you feel hopeful and positive about the situation … The positivity starts coming out in a spray—a giant, desperate happiness sprinkler pointed directly at your face. And it keeps going like that until you're having this weird argument where you're trying to convince the person that you are far too hopeless for hope just so they'll give up on their optimism crusade and let you go back to feeling bored and lonely by yourself.”

One theory of social support and depression suggests that whether relationships have a positive effect depends on whether the person feels like the relationship is meeting their basic psychological needs—autonomy, competence, and relatedness. This article gives the example of friends helping a depressed person with chores and errands. That could make the person feel better, but only if he sees it as an expression of love, rather than something that’s taking away his control over his own life.

We don’t know the details of the friendships in this new study—exactly what they talked about around the cafeteria table, what gestures were made, which were appreciated. But nonetheless, it seems that just being there was enough to have ripples.