[Spoiler alert: The following interview discusses the entire fourth season of Netflix’s “Orange Is the New Black.” Do not read unless you’ve watched.]

The last time Matthew Weiner directed an episode of television was the series finale of his beloved creation, “Mad Men.” So it’s only fitting that his follow-up gig makes just as much noise, and the twelfth episode of “Orange Is the New Black” Season 4 has certainly caused a stir.

The episode, titled “The Animals,” closes with the death of fan favorite character Poussey Washington (Samira Wiley) in a tragic scenario that echoes a real-life murder at the center of the Black Lives Matter movement. But even beyond that devastating climax, the season’s jam-packed penultimate installment is full of memorable scenes: Sophia (Laverne Cox) finally returns to general population; Pennsatucky (Taryn Manning) and Boo (Lea DeLaria) settle their differences; the prisoners put aside racial divides to stage a peaceful protest; the list goes on.

It would be an intimidating assignment even for one of the show’s veteran directors, and this was Weiner’s first time working on the series. His longtime friendship with “Orange” showrunner Jenji Kohan surely helped, but how did he pull it off?

Variety spoke with Weiner about his approach to such a pivotal episode, the process of putting together that cafeteria climax, and whether the experience left him eager for more.

I know you and Jenji Kohan are longtime friends, but how did the idea of directing come up. Was it her idea or your idea?

It was her idea. I thought about it for like a day. Our conversation was, “If I disappoint you, will you still respect me?” I think Jenji knew it was something I should do. We have tremendous creative respect for each other which predates our friendship. She’s someone I talked to before I started “Mad Men” — I was a huge “Weeds” fan. I can say her work has influenced me a lot. I trust her taste. When she asked, I talked to my wife. I knew it was really scary to direct a script I hadn’t written. I didn’t have to do it, in a weird way, but I had to do it. It was a super high risk and I was excited by that.

Was it always going to be this episode? Did she have this one in mind for you?

You’d have to ask her. On my show we would rotate people and source their availability. I always used to get annoyed if directors would complain if someone drew a better [episode]. You hope the material is right for the person. Other than Don at the Foreign Legion [in the penultimate “Mad Men” episode “The Milk and Honey Route”], which had a woman jumping out of a cake, I don’t think I ever had to direct anything with this many people in it, forgetting about this much action.

This cast is so large. “Mad Men” had a big cast, but this is easily twice, even three times, as big …

It’s huge. There’s no comparison.

When you come into a show like this, how do you even approach the fact you’ll be shooting so many critical scenes with so many different actors?

I always care about this anyway, but you really have to know everybody’s name. The best way, even if you call them by their character’s name, is to watch the show. I rewatched the entire show. Then I got a chance to see the first six episodes [of Season 4] as they were being cut, and read scripts for the next ones. I had a chart on the wall. You learn all of the actors’ names and try not to get caught doing something stupid, like say “You sleep in that bunk, so start up there,” and they say, “That’s not my bunk.” You really want to know the show as well as you possibly can. That was a lot of study.

The other thing is you have the writer of the episode with you, they know the world sometimes better than the actors do. Lauren Morelli was by my side. And I could call Jenji if I wanted to. It was a pleasure to not have some of the responsibilities that I’ve traditionally had, and just focus on shooting the script and not worry about episode 13. When we shot [the cafeteria scene], Jenji was on the set working on episode 13 with Tara [Herrmann], asking me if I wanted to read it later. I was like, “I’m a fan of the show, I don’t want to read it,” but also, “Oh my God, I feel so bad for you. When this is done, I’m done. When I’m done shooting this thing it’s all I have to worry about.”

Did you end up reading the finale script too?

I didn’t see episode 13 until it was on [Netflix]. Jenji was like, “You can read it.” I said, “I’m a fan, I don’t want to know.” But I also thought, “How is she going to dig herself out of this?” The only thing I knew is that Poussey’s flashback would be in the finale. Because it was very important to me to know if that was [Samira’s] actual last day. That is a big deal. Your job if you’re the visiting director is to make sure every single person everywhere knows that. I luckily did not have to deal with that. I can’t even imagine shooting that if it was her actual last day.

So what were your initial thoughts when you read the script for episode 12?

It was a very well written script — it was the harvest of a lot of conflict that had been existing in the season. It told this extremely socially relevant and resonant event, but in their world. It was completely earned because [Jenji] had created a story over the entire season that mirrored the way the world works.

We lose this person who is really an innocent, at the hands of an innocent, there’s a double tragedy there. Alan Aisenberg [who plays the young guard, Bayley] had certainly never had a storyline that big before. I liked the sense that even he’s aware of his privilege, [he and his friends were] let out of jail and he’s remembering that.

Almost everybody that I’ve ever loved on the show, who’s alive, I got to work with. That was the amazing thing about being at that point in the season. The first scene up was Taylor [Schilling] and Laura [Prepon]. And the marriage counseling kind of relationship that Poussey and Soso were having, it was the perfect time for it — I loved working with Kimiko [Glenn] too. And Pennsatucky and Boo having that reconciliation, it totally shocked me that was so emotional — I didn’t know that from the page.

There are so many incredible scenes in the episode but that one stands out as one of the most moving moments. What was it like working with Taryn Manning and Lea DeLaria on a scene that was a long time coming?

I think they actually felt that way — they missed being in scenes together, they missed the kindness of their relationship, they missed the comedy they were playing together. It wasn’t in the script for Taryn to get quite that emotional. That happened. It was 11:59 at night we were shooting that and it happened to be Taryn’s birthday.

I knew it was funny. Lea always makes me laugh. These actors really love each other, but what they have that you really want is a competitive aspect to the performance. It’s like you play tennis better when someone’s a better tennis player. They’re not fighting to upstage each other or anything like that, they’re fighting to be great with each other.

We shot it early on in the 10 days of shooting, and that was where I started to understand and design the visual look of the show to take advantage of all these two-handed scenes. There was a lot of mirroring and repetition in the script in a great way, like different people in the time machine, the escalation of Bayley’s teen years, Red and Healy, Lorna and Judy on the phones, the white supremacists coming into the ghetto dorm… You don’t get this in every episode.

This is all very well thought out and planned out to get everybody in the same room at the same time at the end in a moment of triumph that’s going to become a complete tragedy. The director shouldn’t get credit for that, that’s all I’m gonna say. I’m gonna put on the showrunner hat and say Jenji Kohan should get credit for that.

You mentioned Morello’s phone call. That’s a big scene for Yael Stone to do on her own.

We did a couple of versions of that. Yael is extremely capable of being crazy. We didn’t have John Magaro’s half of it, that was read by the AD, Becky Chin — who is really the field marshal of the last scene too. It was interesting to see, it’s a very long conversation and the build requires a lot of skill.

There’s a couple ways you can do it. You could do one that’s all crazy, you could do one that’s all wily, one that’s sort of cold. We had a conversation and I said something like, “Will you fight to be happy at the beginning, and then try and catch him?” [Yael] knew it, she said, “I can’t help myself, because I don’t trust him.” It’s like all of them, they’re so good. You sit back and watch them do it. You try not to laugh over the take. Even in some of the darker moments, not during the big scene, but there’s a lot of gallows humor.

Laverne Cox and Selenis Leyva have another remarkable two-hander with that scene in the salon.

Selenis is a super huge favorite of mine. I want to go back there and see them in real life. The bench is so deep. Almost everyone on that show is capable of being the lead of the show, so when you turn the spotlight on them it’s huge. Selenis was on “The Sopranos” when I was there but we didn’t work together.

That whole thing of seeing Laverne walk into the prison… The first scene we shot with both of them was when she walks into the bathroom. Sophia is a ghost at that point and [Gloria] is really powerful, and her power is bigger than the hierarchy of the prison. I was lucky to have those scenes of reconciliation.

Sophia is very proud — how you get her back to being a human being after being in solitary? That was all in the script. All I wanted to do was to reveal that moment in the mirror. It’s classic: They’re so mean and tough and cruel to each other, that silence comes off as tenderness. It’s good writing, it was a good piece of action. [Gloria] is going to tough love [Sophia] into the chair and put the wig on her. There’s no moment of pity, which makes it even more emotional. They’re so good.

I also love the scene of everybody planning with Red in the library. Danielle [Brooks] had that improv line, “You racist Nazi ho.” Not everybody is allowed to improvise, but it was hilarious. It helped to be funnier on the way [to the ending]. It made everything more powerful.

Let’s talk about the cafeteria. Getting everybody together and shooting that scene, where was your focus?

It’s just like writing a script, bird by bird. I read the script. I talked to Lauren. I talked to Jenji. I did not talk specifically about that scene. I think my biggest concern was that there would be enough activity happening simultaneously. The editing is not always written into the script. “Bayley’s on the floor with Poussey, meanwhile people are being dragged off, meanwhile Taystee is being pulled off the table and sees her.” All of that is happening in real life simultaneously.

I had this amazing AD, Becky Chin, and the first thing that happened is we did a storyboard, so I could see the action in order. I discussed with the production designer to deal with all the safety issues of the physical set. Then you have to figure out where everybody’s standing. You start thinking with the camera how to fill the whole place — where the women in the cafeteria will come out; where is Red’s office — all of this stuff gets planned. I know Piscatella and Red are going to square off in that open area — that’s all in the script.

You have a stunt rehearsal, you get the actors there and you figure out where everybody’s going to be, and then you have another layer of it. Almost every free moment during prep for the show — on lunch every day before that happened, there was a Wednesday off — I went in and walked around again to make sure I knew what was going on.

I got to talk to my DP [Ludovic Littee] and say, “I need at least three cameras, I need the crane, I’m gonna need a steadicam.” He usually operates the steadicam. I said, “You can’t operate it because I need you watching the monitors.” I could watch two at the most, but I can really only watch one.

Then you get there on that Sunday morning. Visualizing it is done a piece at a time, executing it is also done a piece at a time. But if you’ve planned it, you can do a bunch of pieces at once. Normally you’d try to shoot as much of the wide stuff as possible to get rid of everybody. I didn’t want to be shooting Samira’s death at the end of the night. I didn’t want to wait all day for it, but we did kind of go in order. The crane shot was almost the last thing we did.

I’ve talked to some of the actors about it and they all said it was a marathon day.

It was a very long day, one of the longest days I’ve ever worked. It was all planned into the budget and the union and everything, we took a day off during the week to allow us to work as much as we worked that day, because it was the only day you could get everyone’s availability.

The crew was amazing, I think everybody was pumped because it was such a big deal and everybody was there and everybody was being treated equally. There was a lot of emotional support. Jenji was there and was kind of like the general. The star of the day is the cinematographer because they’re the person who is really pulling it off over and over again. That guy never sits down. Ludo was quite confident about being able to do it and no one said anything’s impossible. I was so impressed with the machinery of it.

The most important thing to me was that every person who was going to be on that set knew the entire story and how we were going to do it. And knew that if they were the last people to be shot it wasn’t an insult. Everyone was there for a reason and I was going to shoot everybody, but some of them were going to be there for seven or eight hours before they were on camera.

I have to say it was totally satisfying to have a challenge like that. The entire time, from the minute I got the script until we finished that day, I was dreading that day and saying in the back of my mind, “I wish someone else could do it.” Then when I was doing it, that day took like four minutes for me.

Did this experience make you more interested in directing work you haven’t written?

I’ve always been open to it. I’ve never had time. I made a feature during “Mad Men” and that was pushing it, by a lot. I want to be part of something I admire, and that was what was really cool about it. You go into a series as popular, as well done, as “Orange,” what you’re really doing is risking your own reputation by being part of their great thing, it’s not the other way around. If you go in there and blow it, it’s a bummer. The most important part of it was Jenji was happy.

For me it was very exciting and challenging. Of course, it did make me miss “Mad Men.” It’s been part of the process. Just being there on the set, seeing people discover stuff. The whole delusional dream of writing something on a piece of paper and then seeing it in the physical world is incredible. I’m looking forward to that again.

I’m looking forward to it too. I hope it won’t be a long wait.

I don’t know. I’m working. That’s all I’ll say.