The first clue lay in the bagpipe music.

As five hundred and more students, parents, grandparents and carers gathered for the prize-giving ceremony at Newbattle High School near Dalkeith last week, a kilted former pupil piped them in, over a red carpet. That carpet also spoke volumes, as did a hall so tightly packed and expectant, it might have been a gig at T in the Park.

At the outset, the head teacher said he hoped the evening would be a mix of the Oscars, Baftas and Brit Awards, and he cannot have been disappointed. Those of us presenting prizes sat on stage with the school jazz band at our backs. Countless awards were handed out across every age group, students streaming onto the stage to the throb of pop music, which gave the proceedings a carnival feel. There were also interludes by the band, who could probably leave school tomorrow and take up where they left off in New Orleans.

It was like no school event I've ever been at. In fact, I cannot recall any prize giving in my secondary school days. I later learned that my memory isn't failing, but that they'd been abandoned because they were considered elitist. So when I was a teenager nobody - not the whizz kid in physics or the scary javelin throwers or those who had mastered the art of the souffle - had their abilities publicly acknowledged.

At Newbattle Community High School, whose motto reads "A School of Ambition", the achievements of its pupils are trumpeted at every opportunity. I should declare an interest. The head is my brother-in-law, someone who combines natural authority with an ease on the platform that makes you fear, as he twirls the microphone, that he's about to burst into song.

What was so impressive about the evening, however, was the sense that young people were being taken seriously - and encouraged to take themselves seriously as well. Prizes ranged from the academic and sporting and for work in the community, to gongs for music, reading and drama. The raft of awards won at school, local and national level must have made the teachers, as well as the recipients' families, immensely proud. You could see in the sheepish grins of those accepting their certificates and trophies how much it meant to them too.

It's easy to become dewy-eyed when you only witness the pinnacle rather than the slog and rough patches and disappointments that are part of every academic year. Yet for an onlooker, the spirit of encouragement that Newbattle nurtures is profoundly cheering. This is not a place where cynicism or complacency would be tolerated.

Where education is concerned, government, councils and universities tie themselves in knots trying to improve standards and outreach. Understandably, they are increasingly eager not just for the majority to leave school with sufficient qualifications to have career choices ahead of them, but to bring higher education within the reach of all able students, and improve the numbers of women studying science, engineering, and technology. Yet it's decades since we could rightly applaud ourselves for having a finer and fairer education system than in many countries, a misconception we clung onto long after its sell-by-date, as a result of which we became mediocre and smug.

Watching the results of the hard work of staff at Newbattle - and there are many schools like it across the country - you realise that it is not a curriculum or any Holyrood or local authority directive that makes for a successful school. A first-class education begins with the philosophy that underpins the place, and the commitment and vision of the teachers who put it into practice. High on the list of core principles is valuing students, whatever their talents, abilities or backgrounds.

The catchment area for Newbattle is not affluent, and it has deep-seated social and economic issues to overcome. Sadly, the injection of self-belief and aspiration that the prize-giving engendered might fade quickly for some, but for others it will last, thereby adding another rung on the ladder that leads to the rest of their lives.

This week, as the rebel yells of youngsters freed from the classroom ricochet around our streets, the importance of school to a person's life cannot be over-stressed. As Newbattle's roll call of honours showed, achievement is as much about character as about brains or brawn. These years are the pivot for everything that follows. And not just for the students but for us, because their future is part of all of our futures too.

In some ways, that flash of red carpet at the door of Newbattle High carried a message every good school should promote: welcome to a world where we think well of young people, and want them to succeed.