In Ricky Gervais’s new Netflix show, “After Life,” he plays a small-town journalist who, after being widowed, abandons all the rote politesse the rest of us rely on to get comfortably through our days. As is always the case with Gervais’s work — he’s probably still best known as the co-creator and star of the original “The Office” — some deeply cringe-inducing comedic moments ensue. “Anything you do that’s the slightest bit interesting,” Gervais said, “as many people are going to hate it as love it.” Indeed, since “The Office,” which debuted in 2001, Gervais’s output — whether television, film or stand-up — has been divisive, at times drawing criticism for being smug or mawkish but never at any detriment to his popularity. “There’s no objectivity about comedy,” said the 57-year-old, a frequent Twitter lightning rod. “You’ve just got to own your emotions.”

Has social media changed the way the public perceives your work? Yes, and here’s an example: 20 years ago, if you saw something on TV that offended you and you wanted to let someone know, you would’ve had to get a pen and paper and write, “Dear BBC, I’m bothered.” But you didn’t do it because it was too much trouble. Now with Twitter, you can just go, “[Expletive] you!” to a comedian who’s offended you. Then a journalist will see that and say, “So-and-so said a thing and people are furious.” No. The rest of us don’t give a [expletive] and wouldn’t have heard about it if it hadn’t been made a headline. Everything is exaggerated. But everything’s also an illusion. No one would talk to you in the street like they do on Twitter. They’d never come up and say, “Your articles stink.” They’d never do that because they’re normal, but they’re not normal on Twitter because there’s no nuance, no irony, no conversation there.

So why should we take it seriously? You don’t. If you ignore it on Twitter, it didn’t happen. It’s like going into a toilet stall and arguing with graffiti. If you don’t go there, it doesn’t exist.

But you go there. I do. For fun. Or sometimes research. If I’m doing a warm-up show and I’m about five minutes short of material, I’ll search Twitter for provocative things. You find those dark corners. That’s a good thing about Twitter: I used to have to meet these maniacs, like Agent Clarice Starling meeting Hannibal Lecter. Now I can find the dregs from the safety of my Hampstead mansion.

Has Twitter been good for your comedy? It has. I can see a cross section of society a thousand times faster than I could’ve otherwise. I’ve got 13 million followers. That’s the world, really. I’ll tweet, “What’s a subject you should never joke about?” Some people fall for the trap and say something like, “Psoriasis.” Then I can come up with 10 minutes on that.

Sounds like a good 10 minutes. What’s something that you’ve researched online that was helpful in developing a joke that way? There’s loads of things. Onstage I’ll read out responses to “These are the things you should never joke about,” and whatever I say is quite funny because in your head you think of this one person being angry about the joke. People think someone joking about their issue is the worst thing in the world. I did a joke on “Fallon” about peanut allergies, and someone said I should never talk about food allergies. I joke about AIDS, famine, cancer, the Holocaust and you’re telling me I shouldn’t joke about allergies? The audience has got to be clever enough to know when I’m playing the idiot and saying the wrong thing for comic effect. That’s one of the things of comedy: laughing at the wrong thing because you know what the right thing is.

What makes you confident that your audience knows? All you can do is give clues. I did a tweet that said something like, “I’m your typical liberal, lefty, socialist, snowflake. I agree with antiracists … and yet if I talk about freedom of speech, I’m suddenly alt-right.”1 When did that happen?

You’re saying Twitter is a dirty toilet stall of human thought, but you also rely on it to generate material. Aren’t there more interesting places to look? Do you mean, why am I fighting the easiest targets? Why am I picking extreme examples? Because I’m a comedian, not a politician. My job is to be funny. If I can do that with a little intelligence and fall on the right side, that’s a bonus. To answer your other question, “Do I care that there’s someone who’s taking my irony at face value?” You can’t legislate against stupidity. These are fair questions you’re asking but unfair to only ask comedians. The misunderstanding with contentious subjects is that if a comedian deals with them people think he’s taking the wrong side. I’ve heard posh radio shows discussing whether Ricky Gervais should be “dealing with this” in his comedy. Well, you’re talking about it! Why can’t I deal with it in comedy? You might not like what I say, but that doesn’t mean I shouldn’t deal with it.

To my mind the bigger question isn’t about whether somebody should or shouldn’t joke about a subject, because, of course, everything is fair game. No, not of course. Everyone says that, and then there’s one thing that makes them go: “Too soon! Wrong forum!” When I write a joke, it’s not like I’ve gone, “That’s funny, and I don’t care who hates it.” I try and make it so that if anyone’s offended, I can explain why they shouldn’t be.

Gervais and Kerry Godliman in ‘‘After Life.’’ Rich Hardcastle/Netflix, via Everett Collection

What I was saying is that any rational person listening in good faith probably believes that any subject is on the table for a joke. That’s right, but it’s rare.

So the more important question is whether the jokes are aimed at worthwhile targets, and if they’re cheap or not. I understand your point, and it is a fair question. The joke I do in my “Humanity” special about “When you’re being raped by Satan, I’ll be laughing” — that’s irresistible because it’s so mental. If it was less mental, it wouldn’t be as funny. If someone says, “I don’t agree with your atheism” — O.K. I can’t go anywhere with that as a joke. So I pick extreme examples because they’re funnier.

The material from “Humanity” that provoked — And I knew what that would be before the special went out: Caitlyn Jenner.

My question is not about the Caitlyn Jenner-specific jokes. You build that bit out into this larger thing about transgender identification, and you get to a part about wanting to self-identify as a chimp named Bobo. Is that an instance in which the material was intellectually achieving what you wanted to achieve? That bit changes halfway through. So I come out and I’m explaining the joke from the Golden Globes, which I stand by. It was about a celebrity killing someone with their car.2 That clearly is the joke. But then I say people thought I was in a feud with Caitlyn Jenner, and I go: “It was clickbait. Of course, I rose to the bait.” So I’m saying I’m spoiled and childish. Then I get more and more spoiled and childish as the bit goes on. I become the idiot who believes that being transgender is the same as changing into a chimp. But I have to do the joke like I mean it for it to work.

To connect this to something you said earlier: Was the audience laughing at the right thing there? You don’t think a lot of people were just laughing at the comparison of a transgender person to someone who wants to identify as a chimp? Some people are logical and get it. Some of it is also people saying, “I might not agree with him, and he’s gone too far, but I’m glad he’s not scared to talk about it.” I’m talking about the subject again in my new material. I’m talking about cases where people aren’t trans but they’re saying they are to get put into women’s prison where they can rape women.

That isn’t really a thing, is it? Oh, yeah, actual thing.3 I say that genuine trans people should be up in arms about this. I’m very clear that the perpetrators I’m talking about aren’t trans people. Then I play with it and get things wrong within the joke.

Why do transgender people seem like such ripe subject matter for you? Is it that you’re on some level uncomfortable with it? It’s because of Twitter. You look at Twitter, and it seems like it’s trans activists versus TERFs,4 and it’s all going to end like a battle scene from “Game of Thrones.” Then you go into the real world, and it’s not happening at all.

You might want to spend less time on social media. I’m fine as long as I can properly calibrate what’s there online and also still remember to walk outside in the sun.

That sounds like a drug addict saying, “I’m fine as long as I balance my uppers and downers.” I could be wrong. But no, I know I’m not. There are idiots on Twitter. But there are idiots on the High Street. They just don’t talk to you.

I imagine it’s possible your critics aren’t willing to give you credit for the way you move in your stand-up from telling jokes intended to be understood as dumb to telling jokes intended to be understood as smart. Is that elision part of what bothers people? Well, exactly. I’ll have smartass plays on religious belief5 or whatever and then go the other way. Most people haven’t got the time to analyze the jokes, and I go in and out of the parody too fast for some. But as long as I know the target and some people get it and agree with me, I think the jokes are justified.

Gervais in ‘‘The Office’’ in 2002. BBC/Photofest

This is in the realm of a therapist’s question, but you often play these characters, whether it’s David Brent in “The Office” or Tony in “After Life” who compulsively commit social faux pas. How much of that is you? Do you feel as if you always have a level of self-awareness about what you’re saying? I try to. I do ironic jokes in my social life. All people do that when they joke with each other, and they don’t have to explain themselves. Whereas you do feel the need to explain jokes to strangers. Deep down, I want those 10,000 strangers who come to see me perform to know I’m a nice guy.

Why’d you get into stand-up? You’re not one of these comedians who was doing it at 20. No, I wasn’t. God, I would have been awful. I didn’t know anything. I can’t think what I would have talked about. Before I could do it, I had to learn to relate. Getting fat and old and ugly helped with that. I don’t know if you’ve heard of Simon Amstell. He’s a British comedian. He once said something about young, handsome people doing comedy, like, People are already looking at you; why do you need this?

Do you need it? I don’t. I do enjoy it. I didn’t enjoy it as much doing “Humanity.” I think I was proud, rather. I approached it differently. With “Humanity,” I didn’t write it like I did my other specials. Instead, I walked out with a can of beer and started talking about stuff, like I do on Twitter. It felt brilliant. The audience engaged straightaway. The other good thing about that special is that the audience has known me for 15 years. So I could throw in self-referential things to get over my not being low status anymore. Traditionally in British comedy, a comedian’s been wallowing in the mud with the people. But people know what comedians earn now, so I can’t go out there and talk about, “Well, I’m on welfare.” So I get my low status in two ways. I talk about money with irony: “When I flew in a private plane the first time, they thought I was the cook.” And the other way I do it is to talk about things where the audience is better off than me. I talk about being fat and old and having descended testicles.

Is the idea of being an outsider important to you? It’s really important. But I don’t have to be one with people who have paid to see me. They know I’m one of them who got lucky. But I do have to be an outsider as host at the Golden Globes. That’s when I have to bite the hand that feeds me. Imagine if I went out and was nice to George Clooney? People at home would be going, “Who is this [expletive]?”

How do you reconcile your need to be an outsider with the fact that you’re clearly not one anymore? I can still be an outsider by reminding people that the Establishment hates me.

They can’t hate you that much. You make TV shows. You play arenas. I am in a privileged position, but I remind the audience that not everyone likes me. And it’s sort of true. I’m the son of an immigrant laborer, and I wear bad jeans and drink [expletive] lager. It’s all part of the illusion. Audiences need to be on your side. You can’t go out and hate an audience and want them to hate you. There’s not enough people that would pay for that, you know? It’s still a business. I’m not ashamed at making money.

What’s the best thing you’ve bought with your money? Tennis court.

Are you good? Oh, no. But it’s lovely to have.

Is there a criticism you’ve gotten that you felt was helpful? Or even just valid? I felt bad for the Tim Allen Golden Globes gag. He and Tom Hanks were handing out an award. I said: “I’ll go to our next two presenters. The first has made over $3.5 billion at the box office, won an Oscar blah blah blah. The second is Tim Allen.” That’s unfair. But it’s unfair because anyone standing next to Tom Hanks is going to get that treatment.

Also, who cares? It’s a roast joke about Tim Allen. But I don’t want Tim Allen to think I mean it. He’s had a great career. As long as people go “That’s a bit harsh” rather than “Yes, Tim Allen, you [expletive] useless … ” I’d hate that. It’s just he was the one standing next to Tom Hanks, you know? I do worry about these things. Because there was a person at the end of that joke.

Gervais onstage at the Golden Globes in 2016. Paul Drinkwater/NBCUniversal, via Getty Images

Hollywood awards shows are held up these days as of real social importance in a way that they weren’t even a few years back. What do you make of that shift? I’ve got nothing against someone using that platform for a political idea. Despite what people think of me, I’m not judgmental at all. One minute I can be having a go at Hollywood for taking itself too seriously, then I can be having a go at Trump for caring about Hollywood. And I walk between the two sides because I keep my own politics out of my show.

Why? Because if you’re relying on an audience agreeing with you, you’re rallying. It loses something comedically. Comedy is an intellectual pursuit, not an emotional one. That’s why I don’t do real racist, sexist, homophobic jokes.

I would hope it’s because you’re not a racist, sexist homophobe. Of course. But I do a lot of jokes that aren’t “me,” and I don’t have to remember not to be those things in my real life. It’s like, if you start a joke with “Why do all Mexicans…?” I’ll stop you there, because whatever the answer is, they don’t. Racist jokes don’t work comedically. But jokes about race can.

I’m surprised you don’t think comedy is more emotional. Laughing is. But it’s triggered by getting the joke. If you don’t agree with a joke’s premise, you’re not going to be laughing. If Hitler was here now, telling the best jokes in the world, we wouldn’t laugh. We’d be going, “What about all the bad [expletive] he’s done!”

A minute ago you said that comedy loses something if the audience is agreeing with you. I think you’re crazy if — Oh, here we go.

If you believe that a vast majority of the people who buy a ticket for a Ricky Gervais show don’t agree with what they believe is your take on sensitive subjects. I only play very cosmopolitan areas where they’re smart enough to get the irony. That comes back to the question of why I pick extreme examples. Because they’re easier for people to get. Particularly when you’re doing something contentious, you don’t want to start with a misunderstanding. There are no rules, but when we’re talking about being canceled and wokeness, it is clearer to pick on someone like John Wayne. Canceled 40 years after his death for not being woke in a 48-year-old issue of Playboy magazine!6 His quotes were awful. But what are we to do with it? As an example, I did a joke about taking down Confederate statues. I said: “They should just have amendments on them. ‘Great general. A bit racist.’”

On the subject of cancel-them culture, how do you now think about the work of someone like Louis C.K.? Or Kevin Hart. Kevin Hart apologized for his homophobic jokes. If people don’t accept a person’s apology for a mistake, there’s no value in that person trying to improve. And I hate virtue-signaling. I’ll tell you why it’s bad. Because the more pathetic people’s accusation is, the more these people are saying they’re not like the accused. They’re saying, “Look how good I am.” They’re saying, “I hate that thing because I would never do it.” Why are you telling us?

Presumably because they were offended. If I wanted to get back: “Well done, Rick! Keep up the good work, boy!” I might as well tweet “I am not a rapist.” Please don’t use that as the headline.

You said it. I’m in a cold sweat now.

But to get back to my question. How does what we know about the behavior of someone like Louis C.K. affect our thinking about the comedy he has done or is doing now? It depends on the deed, the accusation, the time, how much you liked them. You make your own mind up. The Louis C.K. thing — is he allowed to gig? Yeah, he is. Are people allowed to protest? Yeah, they are. But you can’t change history. When his leaked thing came out, I listened to it. People were saying: “God, it’s terrible. He’s gone alt-right.” And it’s the same contentious stuff they loved when he did it two years ago!

I disagree. The problem was that his new material was not good. That’s an opinion.

They’re hackier jokes. But my point is nothing to do with the quality of the material. It’s that Louis C.K. isn’t suddenly alt-right. People look at him as if he’s changed his whole outlook to life and the way he writes jokes.

Let me ask you a question related to “After Life.” Yes, best do that. I’m already sweating about some of the things that I’ve said.

The show is about a man who’s decided, as a result of grief, to dispense with social niceties. As a famous person and a successful person, do you have a different perspective than the rest of us on the value — or lack of value — of obligatory social behaviors that some of us might ditch if we had a little more power? The reason we’re nice to people is because the consequences of not being nice would make our life worse. Why do I lie every day? Because I don’t want to hurt people’s feelings. “Can you come to the christening?” “I can’t. I’m giving blood at the orphanage.” I don’t say: “Why would I want to come to a christening of your baby? It’s boring.”

Your last show, “Derek,” was so not about irony or bitterness. “After Life” has those elements, but it also gets at some of the sweetness of “Derek.” Do you see the shows as in conversation with each other? I don’t. I do treat the shows like an exploration into themes. “Derek” is my Ph.D. about kindness. “After Life” is my Ph.D. about social niceties during grief. “The Office” was my Ph.D. about the mundanity of being thrown together in a 9-to-5. “Extras” was my Ph.D. about ambition and fame.

I’m curious about what it meant for you that the first project you created, “The Office,” was so highly regarded. Everyone agrees it’s great TV. No, they don’t. Some people hate it, which is comforting. It reminds me that everyone is different, and opinions are subjective and it doesn’t matter.

People’s incorrect negative opinions about “The Office” aside, how did the early acclaim shape your self-confidence or self-doubt? You have to ignore it. You know there’s going to be a backlash. With me, it’s every six months. For the last 15, 20 years, at least once a year there’s been an article saying this is the end of Ricky Gervais’s career. The first time, I thought, Really? Is it? The second time, I thought, Is it? Third time, I went, Here we go. Fourth time, I went, No, it’s not. And you should polarize it if you’re doing anything mildly artistic.

I guess there was someone somewhere who didn’t like the Beatles. I didn’t.

Now that’s offensive. I preferred the Stones. I do appreciate the Beatles now.

How do you view the trajectory of your work? Does “The Office” stand apart? No, but I’m always going to have an affection for the show. It was the first time I’d tried my hardest at anything. I’m one of those kids that went, “I didn’t study for this exam and still got an A minus.”

Do you have a sense of what you’d be doing if “The Office” had fizzled? Working in a chapeau shop? Maybe a haberdashery? If you want to quote “Spinal Tap” lines, we’ll be here all day! My favorite is “too much [expletive] perspective.” Me and Jane7 said that line every day for about 10 years. I sent Chris Guest8 all six episodes of “After Life.” He sent me back the most beautiful email: “weeping.”

This reminds me of an interview you did in which you recalled a conversation you’d had with Christopher Guest. You two had talked about — I think the Englishism you used was “going off the boil.” Yeah, he was saying, “What if we’re not funny anymore, and we don’t know it?” I went, “Who cares?”

Do you think a creative person can accurately judge if there’s been a decline in his or her work? Probably not. It depends what your aim is. If it’s to keep getting more and more popular, you’re probably going to fail. If it’s to keep getting paid more, that could work. It’s worked for me! I do get asked, What’s your pipe dream? I’d like to live in the middle of the woods. In a mansion. Surrounded by rescue dogs.9 With all the mod cons that hermetically seal the mansion so spiders can’t get in. That’s my answer.

So you’re not one of these tortured artists constantly thinking about how to be more successful? I remember when I was young and had hair I saw that Michael Caine10 said he’d done a “Jaws” movie to buy a new house. I thought, Idiot. You let me down. Now I think, Good on him because a house is a real thing. Rotten Tomatoes11 isn’t a real thing. So within reason I want to do what I want every day, be proud of the work and have a nice life.