Julian Barratt is one of those British comedians whose genius, versatility and originality have garnered him a small but loyal following of passionate fans. Others in this category include top-end talents like Steve Coogan, Chris Morris, Matt Berry and Richard Ayoade. As fans like these are the kind that follow the fortunes of small-screen comedians like Southern Baptists follow televised evangelists, they go rabid when they find out their favourite comic is writing, directing, or starring in a movie, because we, as a culture, have decided that cinema is the apex of all artistic expression and just being a part of it is like a Victoria Cross for creativity.

So, when fans found out that the beatnik half of The Mighty Boosh was going to star in a send-up of 80’s and 90’s science-fiction detective shows, it didn’t just allow them to help their favourite cult hero. The detective in question is Mindhorn, a cyborg sleuth with a robotic eye that also acts as a lie detector. As the series opening voiceover dramatically reminds viewers each and every week, this means he can literally see the truth. This is precisely the sort of claptrap that made programmes like Nightman such horrifically ironic viewing.

But Barret doesn’t play Mindhorn, though. Oh, no. He plays Mindhorn’s thespian portrayer, the buffoonish rogue Richard Thorncroft. It’s Thorncroft that plays Mindhorn. Remember that. Richard, it seems, is a bit of a Dick. At the height of Mindhorn’s popularity, Richard dropped the show and travelled to America to chase dreams of Hollywood glory. Remember what I said about people making movies the Zeus of modern entertainment mediums? Apparently, that applies to fictional characters as well. And it’s not only the show he says goodbye to. He also leaves his co-star and girlfriend (Essie Davis) and self-destructive manager (Richard McCabe) to navigate the world of low-stakes entertainment without him.

He returns with nothing to show for abandoning his closest allies. Destitute, and being a spokesperson for humiliating brands that betray his age and insult his testicular fortitude, he desperately tries to blag his way into work that will purify his toxic profile. Upon hearing that there is a deranged killer in the town his former series was set in and that this killer thinks Mindhorn is real and is demanding an audience with him, Thorncroft returns to the Isle of Man thinking he can turn tragedy into opportunity.

The film opens with an approximation of what his old TV show might look like. It doesn’t make a good first impression. Barret comes out karate kicking and posing like a first-time Austin Powers cosplayer. The parody is obvious and rote. Our introduction to Thorncroft himself is little better. Embodying all the hallmarks of every self-important comedy narcissist that has ever graced the silver screen, he does nothing to set himself apart from that overcrowded section of cinematic stereotypes. But Mindhorn is a grower, not a shower.

After he’s done the mandatory bald joke, the gut joke and all of the pointless celebrity cameos seem to have passed (although, admittedly, Simon Callow’s is rather amusing) the film finds its footing once it believes it has sufficiently explained the set up. After that, the film becomes a comedy of manners and errors. On the Isle of Man he finds his old cast and crew have somehow never left the island, but have chosen to carve themselves out a little corner of the island’s media empire each, with varying levels of success.

His time on the island becomes a ghost train of painful memories and regretful life choices. Essie Davis provides much-needed respite to the funny wigs and cartoon accents the rest of the cast elect to employ. Also, her charisma, subtle humour and acting ability make just about everything she’s in 25% better. Barrett’s cowriter on the project, Simon Farnaby, plays Thorncroft’s old stuntman, a character who starts out as the disappointing son of Goldmember, but becomes much more interesting, as well as funnier, once he stops hiding the spite in his passive aggression.

Steve Coogan plays Peter Eastman, who in turn played Mindhorn’s sidekick, Windjammer. Unfortunately, despite some funny lines, Coogan’s character is hobbled by following the same arc as Farnaby’s. They both pretend to be delighted to see their old friend at first, then they let civil façade slide and do everything they can to add insult to Thorncroft’s injuries.

Thorncroft is constantly putting his foot in it in with lines and stingers that hit the audience’s funny bone like stealthy jabs, seemingly out of nowhere but connecting with full force. The most effective comedy is all in the wordplay. The visual slapstick is contrived with the payoff being obvious the second the props are introduced, and the caricatures are too grotesque to do anything other than create a cringe or two. Mindhorn’s humour, much like the title character’s martial arts, works best when you’re not expecting it.

The further the film gets with its premise the funnier it becomes as it tumbles down a surreal rabbit hole, blurring the line between celebrity and reality, until finally, Thorncroft literally becomes trapped by his own character and has to face up to not being the James Bond-esque super stud he thinks he is. The comedy ravenously takes bites out of Thorncroft’s dignity, tearing away the myths he surrounds himself in, one by one, until he is exposed and vulnerable. To the surprise of all, it is at this point that he becomes a successfully sympathetic character, one whose redemption it’s difficult not to become invested in.

For Mindhorn to be funny it only ever needed the wit of Julian Barratt and his writing partner Simon Farnaby. What it didn’t need was funny accents and farcical prosthetics. The comedy of social anxiety, manners, and arrogance are what make this film shine. Not the pastiche, the slapstick or the crass characterisation of its broadly drawn personalities. But so strong are the workmanlike jokes that raise it above the smog to create something that feels more than just a two-minute sketch that became sentient and got overambitious. Mindhorn, like it’s protagonist, is not perfect, but the more it sticks around, the more endearing it becomes.

Mindhorn is out in cinemas now.

Dir: Sean Foley

Scr: Julian Barratt, Simon Farnaby

Cast: Julian Barratt, Simon Farnaby, Essie Davis, Andrea Riseborough, Kenneth Branagh, Steve Coogan, Russell Tovey, Harriet Walter, Richard McCabe, Simon Callow

Prd: Jack Arbuthnott, Laura Hastings-Smith

DOP: David Luther

Music: Keefus Ciancia, David Holmes

Country: UK

Year: 2016

Runtime: 89 mins