Middle school is typically a time of chaotic emotions, confusing relationships and challenging growing pains. But it may also have a surprisingly lasting influence on the future.

In a study published in Child Development, researchers found that adolescents who were best able to negotiate the relationship minefield of finding friends and making sound behavior choices were most likely to be rated by their parents as successful both socially and professionally when they became young adults.

“We tend to think that peer relationships in early adolescence don’t mean that much, but that tends to be dead wrong,” says Joseph Allen, a professor of psychology at the University of Virginia. “How well you do with peers as an early teen tells us a whole lot about how you manage in a lot of different ways as an adult.”

Allen and his colleagues followed 184 youths from a public middle school in the Southeast, which included kids from both urban and suburban neighborhoods. They interviewed the teens’ parents as well as other adolescents that they identified as their closest friends annually for three years, starting when the participants were around 13. The authors followed up again when they were ages 20 to 23.

“What we’re finding is that the path is not straightforward, it’s more like a tightrope walk between trying to connect well with peers on one side and avoiding getting swept up into peer influences toward deviant behavior like delinquency and drug use on the other,” says Allen.

Indeed, the study showed that teens who best resisted peer pressure during junior high were less likely to engage in criminal behavior or to have alcohol or drug problems. Unfortunately, this ability to resist peer pressure can also be isolating; this same group also had fewer and weaker friendships as adults.

Those who had the strongest interactions as adults, not surprisingly, were teens who walked a middle ground, remaining open to peer influence, but not allowing themselves to be overwhelmed by the pressure to conform. “Teens who can manage that well have strong close friendships as adults,” says Allen. “They’re better at negotiating disagreements with romantic partners when we observed them doing that. They are less likely to have problems with alcohol and substance use and less likely to engage in criminal behavior.”

That doesn’t mean, however, that when it came to the most common pressures during adolescence, such as smoking, drinking and trying drugs, these teens were abstinent. “The people who were best at connecting have a lower risk of problems with alcohol and drug abuse, but they actually drink slightly more,” Allen says. This confirms earlier research that suggested teens who were well adjusted didn’t always abstain entirely, but rather were able to avoid excess.

“In terms of alcohol and drug use, the safest path would be to be more resistant of peer influences and slightly less connected, but that would then cost you in terms of your social relationships,” Allen notes. And being socially isolated could have negative health consequences. “The research shows that being socially isolated as an adult is as big a risk factor for dying early as cigarette smoking or obesity,” says Allen. “There’s no free lunch here.”

As with many behaviors and their consequences, there are tradeoffs. Teen drinking is obviously not socially desirable, but it could lead to fewer friendships that translate into isolation later in life. The complexity of these actions and reactions may in part explain why abstinence programs of any kind, whether for sex, alcohol or other drugs, aren’t particularly effective, since they come with a cost in peer connections and acceptance that teens aren’t willing to pay.

The findings also highlight how important being accepted by their peers is to teens, and suggests that adults should take these adolescent priorities more seriously. “Many people think, ‘Why are teens so preoccupied with these relationships? They’re really no big deal.’’’ Allen says. “They’re preoccupied because these [early relationships] are precursors for how they will function in life socially for the rest of their lives. [Relationships] are critical to physical and mental health.” Rather than discounting them, it may be worth exploring how to improve them, while teaching teens to balance their desire for acceptance with an appreciation of associated risks.