Shaun Dellenty uses his experience of homophobic bullying to help pupils and staff to understand diversity and inclusion. Photograph: Shaun Dellenty

The last time I walked out of Lutterworth grammar school, back in 1987, I nearly gave up on my future.

Years of sustained homophobic bullying from pupils in and around school meant that all signs pointed to an unhappy exit from planet Earth at the earliest opportunity; a feeling compounded by the fact that my parents had recently discovered the truth behind the graffiti that was scrawled all over the town. I was gay.

My parents' reaction, in a genuine attempt to do the right thing, was to announce they were going to book me in for electro convulsion and psychotherapy.

But my feelings of anxiety and depression were so deep rooted that I was sticking knives into my arms and exploring ways of ending my own existence. School at the time meant rejection, dread and humiliation. Despite studying for my A levels, I was becoming a non–attender. So I was called to the head of sixth form. He asked me why I had missed lessons. For the first time, authenticity seemed the best option.

"I'm gay, and I'm having a terrible time."

"Oh I see," he said pushing his chair backwards.

"Sometimes I think it would be better if I just left."

"Yes, well perhaps that would be for the best."

And with that I began my walk towards the school gate and an uncertain future. In the intervening years I fought hard to see the bigger picture and never to give up on life, hope and education. Decades passed, Aids wiped out a generation of young people, wars were won, ages of consent were lowered, and perhaps, one day soon, I will be free to marry someone because I love them.

Two weeks ago, by invitation, I walked back into the school I had walked out of: Lutterworth Grammar school, now Lutterworth college.

I found myself back in my old maths block, accompanied by one of my old – but seemingly not older – teachers to talk to pupils about my experiences as part of the first ever Lutterworth college diversity day.

Lutterworth is a small market town in middle England, which despite being only 20 miles from Leicester, seems wrapped in the same small-town shroud of limited perspectives that it was in 1987. This inaugural diversity day provided students with information on people living with HIV, religions and disabilities, practical activities to develop a range of cultural skills, and a workshop looking at the tragic case of Sophie Lancaster, the student who was beaten to death for being a goth.

Lutterworth college principal Andrew Cooper told me that, despite living close to Leicester, one of the most vibrant and culturally diverse cities in the country, many students come to the college with a limited understanding of cultural diversity. The day was one way of helping to address that.

But other important diversity work has been going on at the college and a recent Ofsted report judged that the college had a "good understanding of problems caused by various forms of discriminations, for example racism and homophobia".

At my own school, Alfred Salter primary, in December 2012 Ofsted found our anti-homophobia work to be "outstanding". These are clear signs that Ofsted regards preventing homophobic bullying as a high priority. Other schools please take note.

I had returned to Lutterworth college, not as a damaged ex-pupil seeking closure, but as a fellow school leader. I found a much improved organisation. Since confirming to my own school community that I'm gay and had been bullied, I have founded a charitable organisation called Inclusion for All. I now train other teachers to help prevent homophobic bullying.

The audience for my final session of the day was all boys. They listened intently as I outlined the damage that using the word gay pejoratively can cause. As the final bell rang, a few boys approached me.

"We wanted to shake your hand, sir – you've inspired us. We have been doing this kind of bad stuff and wanted to say thanks."

Three hours later I received a tweet: "Thank you sir, you've changed my life."

As I walked out of Lutterworth college in 2013, I felt proud of them and proud for them.

Shaun Dellenty @ShaunDellenty is deputy head at Alfred Salter primary school in Rotherhithe, London. In 2010, he launched the Inclusion for All initiative to tackle homophobic bullying in his school and now hosts in-house training days for external teachers and leaders to learn how to implement similar schemes in their schools. The next training date will be held at Alfred Salter on November 13.

Samaritans is available around the clock every day of the year for anyone who can't cope. Their telephone number is 08457 909090, or you can email: jo@samaritans.org.