The most interesting thing about Gene Wilder’s Willy Wonka is that it’s one of his most restrained and demure performances. It’s a portrayal which, more than any other role, demonstrates that he was not merely a comedic performer, but an actor with a brilliant understanding of narrative and tone, an understanding probably superior to the film’s director. His genius defines the film and transforms it from being an amusing, satirical romp into something much cleverer and darker.

In the heyday of his career, Gene Wilder primarily veered between two archetypes: he was part of the neurotic, satirical comedy tradition embodied by Woody Allen; and he was also a broad, almost pantomime character, a kind of goggle-eyed grotesque, assisted by a striking resemblance to Harpo Marx. The two overlapped in his numerous collaborations with Mel Brooks: an over-the-top, gleefully indulgent portrayal of pathetic people, like the infantile, craven accountant Leopold Bloom in The Producers, or the manic, bipolar titular egotist in Young Frankenstein. Such shrieking melodramatics also defined much of his work with Richard Pryor. Yet Wilder added something else to such characters, something crucial to making the films work: he added charm. In another actor’s hands, Leopold Bloom would just be an unlikeable loser; his lackadaisical character in Blazing Saddles could have been dull. Yet Wilder was brimming with an unusual kind of charisma. He looked alien, but affably so: his soft, child-like visage and large blue eyes lent themselves to it, as did his ability to inject a warm humanity into weird people.

But perhaps he was best of all when he pulled himself back and indulged in comically self-aware detachment. This is the essential wittiness of the Wonka role, his most iconic and his greatest. Although his portrayal is conventionally described as “enchanting” or “whimsical”, such descriptions, whilst doubtlessly true, don’t get close to actually explaining why he was so enchanting or whimsical.

Willy Wonka is a metatextual character. He is a sarcastic being who exists outside of the world, dropping in and bending it to his liking, almost always conducted with a likeable dryness. The nature of Wonka’s introduction was suggested entirely by Wilder himself: he emerges from the factory, scowling, and limps with a cane towards the crowd. He is silent, almost rigid, glowering. As he nears the crowds, he leaves his cane behind, but keeps walking forward – until, in the way a Looney Tunes character walks off the side of a cliff and only falls when they notice it, his hand awkwardly grasps thin air, searching for the cane. But instead of falling, Wonka somersaults forward – and, perhaps crucially, not with a grin, but a quiet, wry, self-satisfied smile.

In playing Wonka, Gene Wilder is performing a performer: a man who is aware of the point of his role in proceedings, but instead of being a giddy, wisecracking, friendly wizard, he is one who mocks his guests, a parody of the role he’s meant to play. It’s as though the character of Wonka seems to know what’s he meant to do in the story, and instead of obediently playing ball, he satirises it instead, abandoning commitment for his own amusement. This is, to say the least, a fantastic idea. So when Augustus Gloop struggles in the chocolate river and his mother screams, Wilder simply pulls a face and stoically states, emphasising every pause: “Help. Police. Murder.” Similarly, when disobedient Mike Teavee runs off, Wilder’s Wonka – utterly unsurprised and hilariously apathetic – unenthusiastically murmurs: “Stop, don’t, come back” without an iota of emotion in his voice apart from boredom. There’s no smugness, only a sense of dry, self-deprecating weariness. In other words, Wilder, the pantomime grotesque, in playing the ultimate in potential over-the-top pantomime wizards, makes the – and I don’t use these words lightly – absolutely astonishing decision to play the straight man.

Not only is this utterly hilarious, it works for the character perfectly: after all, Wonka shouldn’t be some standard-issue wacky wizard. The fact that he is disorientating and tongue-in-cheek works better for a character who is such an unpredictable enigma. Indeed, it creates the space for real terror to emanate from Wonka, most evident in the crazed psychedelic boat ride, in which his utterly weird monologue subverts the very idea of his stock enchanting wizard character.

Johnny Depp’s Wonka attempted something similar, but failed miserably for many reasons, largely because Depp lacks Wilder’s natural charisma and because instead of being the one who provides the jokes, he is often the subject of them (tangentially, Depp’s Wonka is what might happen if you combined Wonka with Leopold Bloom – two characters who couldn’t possibly be more different. It is a disaster).

As a result of Wilder, Willy Wonka and the Chocolate Factory is one of cinema’s great black comedies. There is one more trick up Wilder’s sleeve, however: by wandering around so much of the film with an air of quiet sarcasm, the moments of real sincerity have much greater power to enchant the audience. There’s only a few of them – in parts of the ‘Pure Imagination’ song, a performance which achieves a captivating balance between his detached satire and a subtle, loving benevolence captured in only a handful of moments, as well as the ending. In the film’s final minutes, he begins by indulging in the standard Wilder big comedy bit: over-the-top screaming and shouting. But instead of the comic desperation it’s used for in the Mel Brooks collaborations, here it’s simply shocking, humourless anger. By containing it all in one moment, contrasted enormously with an otherwise subtle performance, it’s a crushing scene for the audience. And then, when Charlie proves his worth, Wilder pulls a lever and reverses it within seconds, warmly embracing Charlie with all the sarcasm dispelled. It elevates the character to a mythic position occupied by the likes of, say, Mary Poppins and Peter Pan. More than anyone else – including Roald Dahl – this is down to Wilder.

Gene Wilder was always a humble, gentle, and rather self-effacing man. It’s perfectly possible that he never really realised how great an actor he was. Yet he never aimed for glory; if one reads how he described himself, there is a sense that he regarded it as his duty to provoke smiles and laughter, doing it out of generosity. To say he succeeded at his vocation would be an understatement. As Willy Wonka tells Charlie: “Don’t forget what happened to the man who suddenly got everything he always wanted. He lived happily ever after.”