Spoiler Alert: Do not read if you haven’t watched “starting now,” the Season 3 finale of “Barry,” now streaming on HBO Max.

After three seasons of barely getting away with his many crimes, Barry Berkman (Bill Hader) has finally been caught.

Season 3 of Hader and Alec Berg’s increasingly dark comedy series “Barry” ends with the title character — a reluctant hitman whose attempts to avoid the consequences of his actions have caused increasingly greater tragedies — apprehended by a SWAT team, heading to jail for the murder of detective Janice Moss (Paula Newsome). That act, which has hung over the series since Season 1, initially seemed like it would get Barry in jail even sooner, when her boyfriend Gene Cousineau (Henry Winkler) discovered that Barry, his student, was responsible for her death. But after intimidating Cousineau and convincing him not to tell anyone the truth, Barry doesn’t seem to have to worry about his former acting teacher anymore.

According to Hader, when the writing team began the process of mapping out the show’s third season, they had a few basic ideas for the storylines, and from the jump, they knew the season would end with Cousineau catching Barry.

“Our first day of writing Season 3, we came in and said, ‘All right, here are the basic ideas,'” Hader told Variety. “And they were ‘Cousineau knows in the first episode; Barry knows that Cousineau knows; Sally [Sarah Goldberg] has her own show, and she’s gonna lose it; NoHo Hank [Anthony Carrigan] and Cristobal [Michael Irby] are gonna be a couple, Fuches [Stephen Root] has a vengeance army. And in the last episode, Cousineau is gonna catch Barry.'”

Getting there, however, turned out to be a challenge. In a finale filled with gigantic changes for every character — Sally experiences the highs of success, and the crushing lows of failure, Fuches winds up in prison and NoHo Hank nearly loses his lover before getting him back — wrapping up the storyline between Cousineau and Barry went through the most work to get right. After largely keeping the two characters separate for the second half of the season, the writers brought them back into each other’s orbit with the introduction of Jim Moss (Robert Wisdom), a retired Navy veteran and Janice’s father.

When Jim manages to deduce that Barry — not Fuches, as the police believe — was the assassin responsible for the death of his daughter, he convinces Cousineau to help him trap Barry and hand him over to the police. So late at night Barry, on the road after almost being shot by fellow ex-Marine Albert (James Hiroyuki Liao) in a separate climatic confrontation over the death of their fellow veteran Chris (Chris Marquette), receives a phone call from Jim asking him to come to his home to talk. Barry calls Cousineau, who cryptically tells Barry, “He wants to take us down. I don’t know what else to do.”

Panicking, Barry arrives at Jim’s home, to find Cousineau out at the curb with a revolver. After grabbing the gun from Cousineau, he sneaks into the house to find Jim pouring himself a drink. Barry points the revolver at his target’s head — only to be told “Freeze, drop the fucking gun!” by a SWAT team that emerges from the shadows.

“That scene, or a version of it, was always in there, and then it changed a lot even during shooting leading up to the episode,” Hader says. “The version that it is now was rewritten probably a week before we shot it. There was one version where it was Cousineau hopping in Barry’s car, Cousineau waiting outside of Barry’s apartment — all these things — but in order to make it feel like things were organic of what they would be, it took awhile. And I think the big thing we hit on that helped was Jim Moss calling Barry. That was very late in the game. ‘Oh, what if Jim Moss calls Barry, Barry calls Cousineau and you cut to Cousineau outside with the gun.’ That was what we needed.”

Ahead of the “Barry” finale, Hader talked to Variety about wrapping up the stories for all of the season’s major characters, shooting the tense confrontation scenes and why he choose to direct all eight episodes of the show’s upcoming fourth season.

Do you think Cousineau still cares about Barry after everything that happened?

No. I think by the end of this season, Cousineau has done what he’s wanted to do, which is get justice for Janice. And by doing that he has gotten true forgiveness. The stuff he was doing beforehand with Laura San Giacomo’s character, giving her all these things, that’s making himself feel good. He’s doing those things, but really doing it so you can feel good about himself. And he doesn’t really care if that woman gets her play on or whatever. He just feels guilty. But by turning Barry in and risking his life and doing what was right — the only way he got there was Jim Moss, in that scene in the garage, basically saying “You’ve got to make a choice” — he has achieved real forgiveness.

How did you come up with the final shot of the episode, with Jim framed in the window of his house?

Initially, it was that Barry was going to get taken out, and the cops are going to be yelling, and there’s gonna be onlookers and all that — and then we did a location scout of that house. And on that location scout, we were inside and I just saw that window. And I thought “Oh, it’d be really interesting to see Jim Moss and Cousineau outside there after they’ve caught Barry.” And then it kind of hit, “Oh, it’s interesting. Jim Moss has caught Barry, but he still has to go inside that empty house.” So it was this idea of everybody’s leaving, and it’s just him alone with the memory of his daughter — and he doesn’t want to go inside that house. Because it’s empty, and the reason its empty is because of Barry. And it just felt the right kind of note to end the season on, because it was so much about trauma and victims of violence: Barry’s, and other people’s violence.

How did the storyline of Albert confronting Barry come into play, and why did it feel appropriate for Albert to choose to spare him?

What happens is that Fuches kind of weaponizes Albert, like he’s weaponized everything. So Albert finding Barry, he’s not really there as a cop, he’s there as someone who loves Chris. And he wants to kill him. And he sees that when Barry breaks down in front of them that Barry isn’t a master killer. He’s not Jason Bourne, or a genius like Walter White; he’s a scared boy. And specifically for Albert, he is a soldier that is heavily traumatized and has done a lot of awful things. And Albert in that moment decides, “I can’t be like the other people we’ve seen given over to this violence.” He decides to give Barry what he’s wanted all season, which is forgiveness. And he says, “I wouldn’t have a daughter if you hadn’t saved my life,” and Barry’s given his humanity back. And Albert doesn’t turn him in because he understands Barry on some level in that moment. He sees a guy that’s not malevolent — he’s someone who’s massively damaged. That’s what he says: “Starting now. Stop all this shit. Starting now.” Like he has a debt to him.

What was it like for you shooting that breakdown that Barry has?

He’s expecting to die there. And I think when Albert comes up, we had this in dialogue, but it felt really kind of corny, but what he’s thinking is, “Oh, there’s Albert. This started with Albert.” It’s a cycle; he saw Albert get shot. He thought it was this guy, and he went in and killed that guy, and that guy was innocent. And so we purposely staged it to look like Barry’s in the same position as that Afghani guy from Season 2. And he kind of knows, “Oh, this is it, this makes sense, I’m gonna die.” I think Barry, what he kind of cares about more than anything, is Barry. So he’s thinks he’s going to actually die, and he’s never really been in this position. And it’s not some cool James Bond thing where he’s gonna trick the guy. He has a panic attack. And shooting that was really hard, especially directing that scene, and then giving myself a panic attack. I wouldn’t recommend it. It’s not the best thing to do.

The breakdown happens in the abandoned field from the first episode. There’s a lot of parallels between the first episode of the season and the finale. Was that a conscious decision?

Yeah, even the big oner of Sally going through the set of her show and she watches a scene of two stunt people showing the abuse that she suffered in her marriage. You know, their actions and what happens to her in the final episode, mirror each other.

On the subject of Sally, I wanted to ask how you mapped out her arc. I thought she was growing a lot this season, and she really goes through a shift in the last two episodes.

She’s having success, she’s feeling really good about herself and then once her show goes away, you’re watching her slowly get the shit kicked out of her. It’s a new place, a new anger. Again, it kind of shows this cycle of violence. You know, Barry yells at her in Episode 2 and then she yells at Natalie in the elevator. And then Barry in Episode 8 tries to save her from doing that, going, “Look, you don’t want to go down my path.” And then she ends up doing something infinitely worse by killing Taylor. And he tries to take it, he says, “I did this.” Wouldn’t it be great to just say, “Let me take all that. I started this, let me just take it back. Let me own it?” And that’s just not possible.

But I think with her, it was just giving her a success and seeing what Sally looks like when everything’s going right. And she’s really talented. That’s the thing: Sally’s good. And seeing someone who makes a show that’s well-received and then, at no fault of her own, it gets taken away, and then no fault of her own, stolen by her assistant and refashioned into this silly show about cupcakes — she loses her mind, you know? The interesting thing for us, what I hope, is that there’s people who might watch that and go, “Well, you can’t act like that.” And other people watching gosh, “Gosh, I really relate to that.” If that happened to me, I would lose my mind. It was just trying to make it as honest as you could with her. It started with “What if she got everything she wanted? And everything went great. How would she be, and then at no fault of her own, everything falls apart.” I’ve seen that happen, especially in Los Angeles, numerous times.

Why did it feel the right choice to have her leave California for her home in Joplin at the very end of the episode?

Well, there is no version of her and Barry ever staying together. It was kind of a funny thing for us. You think, “Oh they’re gonna go off together,” and then you see she’s like “No, fuck you, dude, I’m getting the hell out of here.” Which is good. I don’t think when she comes to him at the beginning of the episode, it’s like “We’re gonna be back together.” She’s at her lowest ebb, she wants something violent done. So she goes to Barry, the person who knows how to do this. And Barry thinks he’s her rock or something. But in reality she’s done something really terrible and the big question is, “Will she ever be the same again?” She now has Barry’s disease. Her and Hank.

Since you mentioned Hank, why was his relationship with Cristobal important for this season? What did you want to accomplish with their reunion in the last episode? It ends on a note I found a bit bittersweet and ambiguous.

It was nice to have a couple that you were rooting for. A couple that’s actually in love, you know? I don’t know how ambiguous it is — it definitely feels that Hank has to go through hell, and has to resort to violence to save the person that he loves. And I think, like Sally, it changes him. You know, how can it not? I think their love, it is a very loving reunion. The thing we tried to get with that last look from Hank was, how is he different?

This show has kept its Hollywood stories, but it almost completely abandoned the idea of Barry being an actor. Was that always the plan, or did it just happen that way? Will we see him try to be an actor again?

It just kind of naturally did that. I think that was the way into the story. And then as you start writing it, you go, “Why would he ever go back to an acting class?” If the reason you’re doing it is, “Well, that was the logline of the show,” well, why does that matter? The story doesn’t want it anymore.

This season also saw the cast very splintered in their own storylines. Why’d that feel like the right choice for where “Barry” was leading?

Because anytime we tried to bring people together, it just felt forced. It felt like everybody was on their own little journey.

What can you say about Season 4? Is Barry going to spend it in prison?

I can’t tell you anything. I mean, we’re writing it right now, I don’t know.

Got you. It’s been announced you’re directing all eight episodes of Season 4. How did that end up shaking out? I know this season you and Alec Berg were the only two directors.

Well, I love directing, and I think I’ve just gotten more confident at it. And I asked Alec about it. And he was like, “Yeah, why don’t you do that?” So I think it was just having a very clear vision of what the show is from the get go, and I think so much of it is people trying to interpret my ideas of how things should play out. And it was discussed, especially with [executive producer] Aida Rodgers, who said “I think you should be doing all of these, Bill. Just cut through the massive game of telephone that happens when you have other people do it.”

How long do you plan for the show to run? Will Season 4 be the last? A lot of times this season, it’s felt like a final season to me.

I don’t know. We’re still figuring that out. Every season we’ve done of the show, people have said “No, don’t do another one.” We did Season 1, I remember The New York Times said, like, “Don’t ever do another episode.” Every season people go “No more!” I don’t know. We just take it scene by scene, and if it makes sense for it to end, it’ll end.

Well, Bill, thanks so much for taking the time to speak with me.

No problem. Hope it didn’t freak you out, the last episode.

Oh no, I loved the last episode. It was great.

Yeah, people were having panic attacks when we had a screening of it. I was like, “Oh great.”

Oh, wow.

Yeah. Comedy!

This interview has been edited and condensed. For more “Barry” postmortem interviews, read an interview with Henry Winkler after the Season 3 premiere, an interview with Sarah Goldberg after Episode 4, an interview with Anthony Carrigan and Michael Irby after Episode 5, and an interview with Stephen Root after Episode 7.