Kids who were bullied and acted as bullies themselves were at higher risk for depression, anxiety and panic disorder years down the line, in a new study.

Researchers have known that bullying can take a psychological toll on both bullies and victims, but it’s been unclear just how long those effects would last.

One report published earlier this month found bullying targeting lesbian, gay and bisexual youth contributed to their feelings of depression and worthlessness as young adults.

In the new study, depression and anxiety tied to bullying at school persisted at least through people’s mid-twenties. Worst off were those who had been both bullies and targets of bullying, according to findings published Wednesday in JAMA Psychiatry.

“It’s obviously very well established how problematic bullying is short-term,” said William Copeland, a clinical psychologist who led the new study at Duke University Medical Center in Durham, North Carolina.

“I was surprised that a decade down the road after they’ve been victimized, when they’ve kind of transitioned to adulthood, we would still see these emotional marks for the victims and also the bullies/victims.”

His team’s research included 1,420 youth from Western North Carolina who were asked about their experiences with bullying at various points between age nine and 16, then were followed and assessed for psychiatric disorders through age 26.

Just over one-quarter of kids and their parents reported they were bullied at least once, and close to one in ten said they had bullied other kids.

After adjusting for the participants’ history of family hardships, the researchers found that, compared to young adults with no history of bullying, former victims were at higher risk for a range of psychiatric conditions.