“A good day is when I don’t go around wanting to shoot random strangers in the face, and then turn the gun on myself,” says Tony, the defeated antihero of After Life (available now on Netflix). Tony’s wife, Lisa, has died from breast cancer; now he says he is only alive because he has a dog to feed. Rather than taking his life, he has committed to acting like a thundering dickhead to all who cross his path.

And so he directs his ire at a man who has the temerity to eat crisps loudly in the pub; at his father who, due to his dementia, keeps asking after his daughter-in-law as if she were alive; at a colleague whom he repeatedly mocks for his junk food habit; and at the supermarket shelf stacker who, when asked where the dog food is, tells him it’s next to the cat food. “There’s no advantage to being nice and thoughtful and caring and having integrity,” Tony tells his boss, witheringly. “It’s a disadvantage, if anything.”

Yes, Tony is a man for whom not being an arsehole would take a level of effort that he’s simply not prepared to put in. All of which makes it particularly piquant that he is played by Ricky Gervais who, in 2011, told this newspaper: “I don’t have to be nice to anyone,” and whose capacity to piss off great swathes of society with a single utterance is pretty much unrivalled.

By way of a recap: there was Humanity, last year’s Netflix standup show, in which Gervais delivered an indulgent sermon on the nature of offence and seemed to suggest that, as a comic with his own TV series and 13 million social media followers, his freedom of speech was somehow being curtailed. There was his stint as the host of the 2011 Golden Globes, where he ridiculed Bruce Willis, Robert Downey Jr and all actresses who had ever been airbrushed for publicity material, and the 2016 Golden Globes in which he mocked transgenderism.

Before all of that, there were the standup routines in which he baited Gypsies and fat people, plus that time on Twitter when he insistently used the word “mong”. If Gervais were to be parachuted into the middle of the Antarctic, it would take roughly 20 minutes before the penguins were lining up to peck his lights out.

So now we have his latest creation, Tony, who remains wholly unrepentant about his atrocious behaviour and who is possibly Gervais’s most convincing character to date. Tony is so undone he can’t manage the basics such as grocery shopping, leaving him to breakfast on vegetable curry straight from the can, and who decides to do heroin for the first time because, well, why not? Naturally, you’ll find the usual Gervaisian fat jokes here, plus a gag about paedophilia that will make your eyes water.

However, these moments are offset by intermittent displays of poignancy and pathos, as well as some terrific supporting roles from Roisin Conaty, Penelope Wilton and Diane Morgan. A grim portrait of grief, After Life can make for difficult viewing but not because of the catastrophic misfires we have grown to expect from Gervais.

For the first time since The Office, he has made a show with humanity and heart.