Major spoilers follow for the season four finale of Superstore.

The last 10 minutes of Superstore’s season four finale, “Employee Appreciation Day” are unlike anything else the show has ever done. The corporate offices of the Cloud 9 chain of Walmart-esque department stores, in an attempt to quash talk of unionizing at the location where the series is set, call in Immigration and Customs Enforcement. And when officers raid the store, Mateo (Nico Santos), an undocumented Filipino immigrant, is on the clock. Though his coworkers try to help him evade the officers, he’s caught and taken away.

Related Superstore is the next Great American Sitcom

What’s amazing about “Employee Appreciation Day” is how many different tones the episode blends. The moments in which Mateo, Amy, and Cheyenne race through the aisles of the store while Dina uses security cameras to track the ICE agents have the feel of The Bourne Identity. There’s a big group scene set in the store’s warehouse, which offers some of Superstore’s signature comedy. And the inherent idea that one of the team members could be detained or worse is very dramatic.

And that’s before you get to Amy and Jonah’s shared desire to make sure the union happens.

It’s a big, big swing for what is ultimately a pretty sprightly sitcom. But it also marks Justin Spitzer’s final episode as showrunner. Spitzer, who created Superstore, will be stepping into a consulting role for future seasons, and handing the reins to the series’ other two showrunners, Jonathan Green and Gabe Miller.

It’s not a rancorous departure, but it’s definitely one where Spitzer (who wrote this finale) leaves Green and Miller with a lot of story to untangle when season five begins.

So I wanted to ask him just where the idea for “Employee Appreciation Day” came from, what he’s thinking about as he steps back from running the show, and how Superstore might find new ways to bring conflict to the Jonah and Amy relationship. Our conversation, lightly edited for length and clarity, follows.

Todd VanDerWerff

What was the origin of the idea to end the season with an ICE raid and Mateo being taken away? This TV, so he probably won’t be deported, but getting out of that story is going to be a lot of work.

Justin Spitzer

I don’t think that he would necessarily be deported. In fact, we had originally intended to [tell that story] earlier in the season, and as we were talking about it, we made sure that we had ways to keep him within the world of our show. I know fans will probably see this and figure, oh, Mateo is deported. But he is detained, and there is a process to fighting that.

In terms of the decision to do it, it was something that we had in the back of our minds for a while. Mateo’s undocumented storyline, that arc is interesting, but we felt like it was boring to do yet more stories about — Mateo is scared he’s going to be found out. Mateo can’t do something because he’s undocumented. This was the thing that was hanging over him all this time, and it felt like, let’s just see what happens when it actually hits.

The same way, at the end of season two, you’ve got this tornado, and it could pass by the store and nothing happens. Okay, instead, let’s see what happens when the tornado actually hits.

Todd VanDerWerff

You obviously don’t know how this story is going to shake out going forward, but did you have conversations about what the ramifications would be? You have to keep making Superstore. You have to keep making the sitcom. But this is the sort of thing that has a ripple effect for every single character. Mateo, yes, but also, like, Amy, who’s now upset with corporate. And it has an effect on all of Mateo’s friends too.

Justin Spitzer

That’s tricky, because I know how we talked about [the story proceeding] midseason, but I don’t want to say anything that commits Gabe or Jonathan to anything or imply that they are going to do it in a different way.

It’s a giant change for [Mateo]. It changes our characters too because they have to deal with it, and also the talk of unions will change our characters too. At the end of the [episode], Amy says to Jonah, “Want to start a union?” That has a big throw forward to the future.

I don’t anticipate that we are going to be spending whole episodes at the State Department or embassies or anything like that. I imagine that Mateo would not be deported. We’ll have to figure out how he is still part of the world, but the show continues in a slightly new way. But that is worthwhile for a show that has done 77 episodes. We didn’t have a lot more Mother’s Day stories to tell. This will be good. This is a new place to find a story.

Todd VanDerWerff

Did you do research into actual ICE raids to figure out how this sort of thing might happen?

Justin Spitzer

Yes, we did. We talked to Define American, which is an advocacy group for undocumented people. We called a public relations person at ICE to ask him how various raids might go down. For instance, the uniforms would not say ICE. They say HSI. There’s different ways these raids could [go], but we wanted to make sure it was in the realm of believability.

Todd VanDerWerff

This is weird to think about, but the finale expands Superstore’s mythology in a way. You see the corporate leaders who are making all these decisions that the characters have had to deal with all this time.

Justin Spitzer

In all shows, the world slowly expands. Whether it’s The Simpsons or Parks and Rec, you need more and more people. With us, we met the [Cloud 9] CEO in the season three finale. We went to a managers’ conference midway through this season. We finally got to see what corporate looks like in the second-to-last episode and the last episode. That just sort of felt like the natural progression of the show. I don’t imagine we will spend a lot of time at corporate going forward, but it felt important to establish it.

Todd VanDerWerff

It felt like meeting the Others on Lost to me, honestly.

Justin Spitzer

[laughs] That’s a good thing. Yes.

Todd VanDerWerff

For a while, “Employee Appreciation Day” also hints that it might break Jonah and Amy up, over their fight about the union. But by the end, they’re drawn together more strongly. Tell me about plotting that relationship.

Justin Spitzer

We originally talked about drawing out that conflict over more episodes. Not using [the union] to break them up but using it to create some tension that felt real, but wasn’t tension about whether they were going to stay together or get married, which it felt like we didn’t want to go toward yet.

Over the course of breaking the season, we really didn’t have that many episodes left, and it felt like we still wanted them to have a little bit of that tension, which then gets shattered when they learn what corporate is doing.

So much of comedy comes from conflict. It’s great when you have conflict between your central characters, and it is always tricky to find ways to have conflict where one character is not just wrong or stupid, where you can identify with both characters. [The union fight] felt like that kind of conflict.

Todd VanDerWerff

It’s placing Amy in conflict with herself, too. She started out on the floor, and something like ICE coming into her store is against her values. But we’ve also seen just how much she likes being the manager. I’m interested in how you view her journey — especially having been on a similar journey yourself, going from a staff writer on other shows to now being in charge of one.

Justin Spitzer

Amy does fight for her coworkers. As soon as she learns that ICE is coming, there is no question that she is on the side of the workers. That’s a bridge too far, and that is the thing that makes her say, “Yes, I am really happy being manager, but this is more important. I’m going to give that up.” That is kind of the hero’s journey, when you are comfortable giving up that comfort because there is something greater that you are striving for.

Before [the raid], that is where things get a little complicated and real. She does believe in unions. She does stand by the workers. She’s not super pro-corporate. But she’s put into a situation where it truly looks like there is no point in unionizing because they’re going to shut down the store.

Is she going to stand by and fight this losing battle and give everything up in the fighting of it? Or is she going to do what feels like it makes the most sense both for her and for the workers but potentially compromises her values? Amy’s arc over the show is that she’s gone from someone who was a little more accepting of her lot in life [to someone who’s] learned that she’s a fighter and there are things worth fighting for. Now it’s figuring out what is the thing that’s worth fighting for. I think in this episode, her priorities change.

Todd VanDerWerff

Using your set for an action sequence — which sees Mateo and the others running from the ICE agents through the store’s aisles, while Dina shouts instructions at them as she watches the security cameras — was really smart. How did you put that all together? And how did you write it to align with the geography of the store?

Justin Spitzer

We don’t do a lot of big action sequences, so it took some figuring out. We are a show that doesn’t move our camera very much. We’re very static in a lot of ways, so when you have a scene with that kind of dynamism, it changes things.

As for the geography, I don’t think most of our viewers are particularly aware of the geography of the store in terms of what aisle is what. In fact, they couldn’t be, because we change it all the time. We move around the store. There is no true geography. As long as you were seeing it in parts and you see them running past different aisles, you get the sense of it. We didn’t try too hard to ask, what’s the path he follows?

It’s not the kind of writing I am used to, where you look at your page, and your action lines are so much longer than your bits of dialogue. The trick, just like the trick with our show in a lot of ways, is to shoot the hell out of it and make sure to get lots of on-set moments and improv, and then figure it out [in the editing room].

Todd VanDerWerff

You really bring back essentially every major character in this episode. I think only Amy’s ex and daughter are missing.

Justin Spitzer

Them and Jerusha, I really wanted to bring them back, and we couldn’t for one reason or another. That’s my regret in this episode.

It’s funny, one piece of bringing everyone back wasn’t on purpose, but it was my last episode as showrunner, so I was excited to bring back as many of our people as possible for it. It’s like my own finale, so that felt really good.

But they are just all so great. Bo is such a funny character, Kelly is so funny, the actors are phenomenal. If we had the budget and space on set, I’d want them all to be regulars. This story felt like a good one that they would all have something to contribute to.

Todd VanDerWerff

What prompted your decision to step down as showrunner?

Justin Spitzer

It’s really two things. On, is a desire to start thinking about a few other projects, some things I have been excited to develop. The other one is just to be home a little more. My wife [Jenna Bans] runs Good Girls on NBC and really does the lion’s share of raising our children. That didn’t really feel fair. I want to be able to help out at home more, and I feel confident that the show is in good hands.

You spend a while when you have a new show trying to figure out, “What is this show? What do we do well? What don’t we do well?” It finally just felt like, okay, we have the formula, and other people can run with it.

I’m excited to see what they are going to do with it. In terms of the creation of Superstore’s DNA, it felt like that was done.

Todd VanDerWerff

You did leave them with a pretty significant cliffhanger to resolve.

Justin Spitzer

Yes, that was our ongoing joke in the room. I painted them into the tightest corner of all time and then dropped the mic and got out of town.

Superstore airs Thursdays at 8 pm Eastern on NBC. The first four seasons are available on Hulu. Season five will air in the fall. I promise you’ll like this show if you watch it.