Thirty-six years on from the premiere of Alan Bennett\'s first-ever stage play, 40 Years On, that was set in a school, the playwright has gone back there for The History Boys, now premiering at the National. \"History repeats itself. Historians repeat each other,\" goes a quote in the programme; but should it be added, \"and playwrights repeat themselves\"?

Maybe; but who is complaining when the result is as knowing and wise, intelligent and well-crafted comedy as this? While its minutely observed, autobiographically inspired story of a group of bright grammar school boys preparing for the Oxford and Cambridge entrance exams - a route that Bennett himself took in the 1950s, as the director of this play, Nicholas Hytner, also subsequently did - might seem to be about a narrow constituency, everyone has been to school. This richly funny, deeply thoughtful play about education and history, learning and culture, pitches us all straight back to the classroom.

Would, however, that we were all as fortunate as this particular class. No doubt for reasons of theatrical economics we only get to meet four teachers and eight pupils - a teacher/student ratio that would be envied by any school in the land. Here they\'re being provided with the kind of liberal education that teaches them to think for themselves - and in the process throws down plenty for us to think about, too.

The chaotic general studies classes of teacher Hector - the forever larger-than-life Richard Griffiths - may take place mysteriously behind locked doors, but he unlocks in his charges the kind of passions that have them quoting TS Eliot and Housman, enacting scenes from Brief Encounter and singing George Formby and Gracie Fields songs. (They also learn a whole lot more when they accept lifts home on the back of his motorbike.)

But as Clive Merrison\'s uptight headmaster complains, the results are unpredictable and unquantifiable. Far more rigorous are the history classes of a new arrival, the supply teacher Mr Irwin (Stephen Campbell Moore), who schools them in the kind of techniques that are most likely to impress a bored examiner: as Bennett himself admits in a programme note to doing in his University finals, \"going for the wrong end of the stick was more attention-grabbing than a more conventional approach, however balanced.\"

As Mr Irwin\'s classes here ruthlessly expose this practice - and indeed his subsequent career as a television-friendly historian, shown here in flash-forward scenes, also exemplifies - Bennett\'s intellectually inquisitive and agile play becomes not just about teaching but about the nature of history itself.

Like history, we also view the class through the filter of the different experiences of the people who make it up. While the dryly, wryly comic Mrs Lintott of Frances de la Tour hilariously completes the set of teachers, the pupils, too, are beautifully realised in a brilliant ensemble that includes Dominic Cooper and Samuel Barnett - both seen in the National\'s His Dark Materials - as, respectively, Dakin who has an eventually fulfilled passion for the headmaster\'s secretary, and Posner, who has a unrequited passion for Dakin.

While a little overlong at close to three hours, Nicholas Hytner\'s production is otherwise as intimately engaging as it is ultimately powerfully poignant.

- Mark Shenton