Dr Graham Hawley, the Headmaster of Loretto in Musselburgh, has said it is not possible to completely stamp out bullying in schools.
Speaking at the Scottish Child Abuse Inquiry, Dr Hawley said that it was something he was always concerned could be happening at the school, which charges up to £12,000 per term for senior boarders.
He said: "As a head, you always have this concern that there are things that are going on that you're unaware of, that could materialise years, or decades down the line, and its impact on victims is so acute, that we do everything we can do to prevent it.
"It is difficult to say that with 100 per cent certainty that it is not happening.
"Because the impact is so profound, it's something as a head, I don't think ever leaves us and therefore informs the practice.
"We absolutely have to be on our guard. I don't think it's ever a battle which is going to be won, its always something that is going to be in society.
"Unkindness that can grow and, at its worse, is something that can grow that, with huge regret, has occurred at Loretto in the past."
When asked by Mr Andrew Brown QC, counsel to the inquiry, if the peer-on-peer abuse had gotten worse in recent years, he said it was more the scope of bullying had changed.
Dr Hawley said: "I think there has been a difference with the advent of digital and social media. That's something that didn't exist when I first started. It's a whole new sphere of bullying behaviour.
"Boys, in my experience, were less well supervised.
"There was probably more bullying then, than there is now. I think there has been an ebb and flow - I'm not sure it's got any worse in depth - when it's bad, it's very bad.
"We saw that as a school when we read some of the very harrowing accounts of peer-on-peer abuse - but at a level I've experienced myself, social media has increased it, increased supervision has decreased it. It is something that is always evolving."
The latest phase of the Scottish Child Abuse Inquiry is focusing on alleged abuse carried out in Scottish boarding schools.
Dr Hawley said that he thought he had "understood and processed" the scope of abuse carried out at Loretto before he arrived as headteacher.
However, at the inquiry, he said after the school became involved with the inquiry, they "found out more than what they had been aware of".
Dr Hawley added: "We knew there had been some abuse, that had been previously documented in the media, a long time ago.
"I think the abuse that we were made aware of when we looked at the witness statements was deeply destressing. To read the impact it has had on those people is clearly profound and we regret it hugely.
"I hope we are able to make some difference - we wouldn't have been able to do that without engaging with the inquiry.
"At the outset, there was a sense of we knew what had happened in the past. It was definitely something I had read before I moved to Loretto.
"But reading the papers...there is a sense that I feel I am still processing it more recently, walking the corridors where it would have occurred. It is deeply troubling. I'm not sure I've fully processed it."