There is something rather tragic about James Bond. In advance of seeing Spectre, the latest instalment in the super-spy sex-murder franchise, I watched several of the old films again. The experience was like having your forebrain slowly and laboriously beaten to death by a wilting erection wrapped in a copy of the Patriot Act: savage and silly and just a little bit pathetic.

James Bond is a guilty pleasure but one in which the pleasure is increasingly overwhelmed by the guilt. Even Daniel Craig seems to know this. The actor acknowledged, just before the premiere of his latest turn as Bond, that the character “is actually a misogynist. A lot of women are drawn to him chiefly because he embodies a certain kind of danger and never sticks around for too long.” Craig, who has fronted a gender equality campaign affiliated to Amnesty International and appears to be about as unsexist as anyone who has worked in Hollywood for 20 years can be, gives us the Bond the 21st century needs: a character who is aware that he is both a relic and a thug and is surprised that he still gets to be the hero.

Nobody is saying that Bond isn’t fun. On top of all the explosions and wacky gadgets, the Sean Connery-era Bond movies are so mind-blowingly sexist that they are hilarious. The revamped films aren’t much better – the last time we saw Bond, he was watching a villain tie up his sex-slave lover, place a glass of Scotch on her head as the camera aimed at her cleavage, then shoot her just to prove how evil he was. Bond’s verdict? “Waste of good Scotch.” Again, gross enough to be funny: until you remember that this is the guy we are supposed to be rooting for. It is possible to watch the films ironically but it is hard to sustain a rigorous internal critique when the scenery is blowing up and Dr No must be stopped at all costs. Ultimately, it is terribly difficult to sustain an ironic erection. To do so involves a kind of anxiety that the men and boys of the 21st century know very well.

The new Bond films work because they tackle that anxiety head-on. The director Sam Mendes told Empire magazine that 2012’s Skyfall – the highest-grossing Bond film in history – was about ageing, uncertainty and loss and that this dynamic forces itself through the action scenes, the ridiculous firefights, the awesome bit in which the train carriage packed with explosives ploughs through someone’s ceiling just because they had the budget. Daniel Craig has not been given enough credit for taking a character who was a cardboard throwback even in the 1960s and playing him straight: as a wall-eyed, traumatised thug, a protagonist who is two-dimensional precisely because he is empty inside.

Craig animates the automaton that is Bond by asking just what it would take to make a person behave in this horrific way – and like any piece of well-done puppetry, the effect is sinister. Daniel Craig is the Bond we deserve, a Bond who takes seriously the job of embodying a savage yearning for a lost fantasy of the 1950s. It is about masculinity, yes, but also about Britishness, about whiteness and about heterosexuality, about the loss of certainty in all of these in a changing world.

That is why I agree with Roger Moore that Bond cannot be played by a woman or a person of colour, except in pastiche – Bond’s whiteness and maleness are as much a part of who he is as the gadgets and the sharp suits and the romantic alcoholism. Indeed, these are almost all of who he is. Bond is anxious 20th-century masculinity incarnate, a relic of 20th-century power struggling to come to terms with its own irrelevance, still fighting cartoon Cold War villains as the planet burns – which is what gives the films their melancholy beauty.

The franchise is dripping with camp nostalgia for a time that never really was, a time when men could be real men, which meant that they were allowed to hurt whoever they wanted and still get away with it. It’s right up there in the job description: license to kill. Bond is the kind of hero he is because he is allowed to do anything he wants to anyone he likes, from harassment to outright murder, all while wearing snappy suits and driving cool cars and getting every single one of the girls, for a rather suspicious value of ‘getting’. He may be a dangerous sociopath, but he’s our dangerous sociopath, so of course we’re rooting for him, because damn, look at the other guy. He’s got an eyepatch. And a cat. And he dresses like your granddad if your granddad was the weird judge off Project Runway.

The ’license to kill’ thing always bothered me - on a logistical level as much as an ethical one. Before the opening credits even roll, Bond has usually caused enough mayhem to keep some poor desk clerk occupied in paperwork for a year. Whose job is it to follow Bond around with a stack of forms and a can of disinfectant, explaining his behaviour to grieving widows and elderly parents who don’t understand why their daughter has been petrified in gold paint by goons and left to die in a hotel room by some sleazeball she’s just met? Presumably the job falls to Moneypenny, who seems unaccountably upset that she never gets a shot at Bond, despite the fact that ‘Bond girl’ is a career in which 'work-life balance' is extremely awkward to negotiate.

The problem with the way we watch Bond is not that Bond is a killer. I rather like films about serial killers, those gory thrillers that seduce you into rooting for the twisted anti-hero over the good guy. The problem with Bond is that he is supposed to be the good guy. He is a borderline rapist who is employed by the government to murder people – and yet he is not an anti-hero. He is just a hero. If your child said they wanted to grow up to be just like Hannibal Lecter, you would be worried. Somehow Bond gets a pass and, come Hallowe’en, a legion of little boys will be dressing as 007 with the full support of their doting parents. Bond is a hero for no other reason than that he is on our side, which is how most western nations and particularly the British come to terms with their particular legacy of horror – with a quiet embarrassment that nonetheless knows how to defend itself by force.

The dilemma of James Bond is a pantomime version of the dilemma facing most men who grew up watching the films and wondering what it would be like to be that guy, whom everybody seems to love not in spite of the awful things he does but because of them. In real life, anyone who behaved even slightly like James Bond would be ostracised, arrested, or both. And that is the problem. Bond is still supposed to be a hero but if you knew him in real life, you would be warning all your friends not to invite him to their parties. That disconnect follows men home from the cinema and into their daily lives, because most of the behaviours that are supposed to make you a hero – the things you are still supposed to do if you want to be a strong, respected, manly man – also make you an unqualified arsehole.

That is why James Bond isn’t evil. James Bond, more than anything, is a tragic figure and his tragedy is the tragedy of white, imperialist masculinity in the 21st century. It is a tragedy of irrelevance that becomes all the more poignant and painful in the retelling. It cannot last for ever and it must not last for ever – but while it does I’ll thank you to pass me the popcorn.