P.E. Reed / Getty Images

Teens may not be wrong when they see their social troubles as matters of life and death.

Being excluded, rejected, dissed by friends or otherwise ostracized by your peers is practically a rite of passage of adolescence, but these social challenges— particularly when they are repeated — can have a lasting legacy on health.

A new study of teenage girls shows that “targeted rejection,” in which students are singled out for taunting or personally rejected by a friend, can have measurable effects on the immune system. If sustained, these changes can increase risk for diabetes, heart disease, stroke, mental illness and some cancers later in life, even among those considered to be at the top of the teen social hierarchy.

Researchers have long known that early life negative experience can translate into later mental and physical illness: the more types of trauma people endure during childhood, the higher their risks for all psychiatric illnesses and many physical diseases, too, including cardiovascular disease.

(MORE: Child Trauma Can Lead to Obesity, Heart Attacks, Even Cancer)

How could being rejected, abused or bullied as a child or teen make an adult more likely to have a heart attack? One link seems to connect the chronic stress from teen social situations to a more sensitive immune system, which can trigger an inflammatory state that can damage the brain and body by sustaining a near-constant state of anxiety or of feeling threatened.

To try to tease out how social stress could affect immune response, researchers led by Michael Murphy of the University of British Columbia in Vancouver, Canada, studied 147 young women aged 15 to 19, who were at high risk of becoming depressed because they either had a parent or sibling with depression or because they scored high on a test of attitudes linked to depressive thinking.

Previous research showed that targeted rejection leads to depression three times faster than other equally depressing life events— and the researchers wanted to determine what role immune response has in these connections and how a teen’s social status might lessen or exacerbate the effect on the immune system. High social status in both humans and animals tends to protect against the negative health effects of chronic stress. However, social rejection — which can be a threat to social status — may be different from other types of stresses.

(MORE: How Economic Inequality Is (Literally) Making Us Sick)

Every six months for 2.5 years, researchers met with the teens. They took blood samples, interviewed participants about their social lives and exposure to targeted rejection and assessed their moods. They had the girls rank their social status by placing themselves on the rungs of a ladder meant to symbolize their school’s social and academic hierarchy.

The authors found that girls who had recently been targeted for rejection —which can include everything from bullying and ostracizing to being “dropped” by a peer group or friend —had higher levels of substances indicating activation of genes that produce two specific inflammatory proteins, nuclear factor kappa-beta and inhibitor of kappa-beta.

“These data demonstrate that exposure to a recent targeted rejection life event activates the molecular signaling pathways that regulate inflammation,” the authors write, noting that “If sustained, this heightened inflammatory signaling could have implications for life-span health.”

And even the girls who ranked themselves at the top of the social ladder weren’t spared the immune effects; in fact, they recorded the largest responses, a finding that seems to contradict previous studies connecting high status with protection against negative health consequences from stress.

But because targeted rejection threatens social status, the authors say, it could produce far more stress in those who have more to lose because they’re at the top. From an evolutionary perspective, a strong immune response in this situation might make sense: historically, status fights have often become physical conflicts, which could result in the need to heal wounds and fight infections quickly.

Status has its benefits, however, since the higher-ranking girls also demonstrated a stronger compensatory response, meaning they were better able to counteract and depress the inflammatory response as the urgency of the social threat declined. That, in part, could help explain why chronic stress has fewer negative health effects on those with higher status, the authors say.

It’s also possible that the higher-status girls showed stronger immune reactions because they were simply unfamiliar with the stress of rejection or isolation when it occurred, while those in the lower strata might have more experience with stress-related anxiety over social status and therefore be tolerated to its effect and have muted responses to rejection.

The authors conclude that the study “demonstrate[es] for the first time that acute life events involving targeted rejection are involved with increased expression [of inflammation-related] genes… These findings have important implications for understanding how social conditions increase risk for a variety of inflammation-related diseases including obesity, diabetes, cardiovascular disease, certain types of cancer and depression.”

The research will is published online in Clinical Psychological Science.

Maia Szalavitz is a health writer at TIME.com. Find her on Twitter at @maiasz. You can also continue the discussion on TIME Healthland’s Facebook page and on Twitter at @TIMEHealthland.