Mateo, played by Nico Santos, in Superstore’s season premiere. Photo: Eddy Chen/NBC

Last month, as immigration authorities detained nearly 700 undocumented immigrants in a single day at seven different Mississippi food-processing plants, actor Nico Santos prepared to film his first scene of Superstore’s new season in Los Angeles. In the final moments of the NBC sitcom’s fourth season, ICE apprehended Mateo, the undocumented Filipino immigrant Santos plays, and his friends and co-workers watched him leave in a black van in helpless horror.

Santos, a Filipino-American immigrant himself, was scheduled to film his first scene on the show’s new detention center set. Known for his biting fashion criticism, Mateo emerges for a visit from Cheyenne (Nichole Bloom) and Amy (America Ferrera) in a wardrobe that says it all. “When I first saw Nico in the orange jumpsuit, it took my breath away,” said the episode’s writer and director Jackie Clarke. For Santos, too, the costume felt “odd” and “sad,” but appropriate since the diversity of the cast and the show’s mission of telling working-class stories demands a certain pathos other comedies can’t deliver.

“Because the ICE raids had just happened, it was a reminder of the gravity and the impact of the story we were trying to tell,” Santos said. “A lot of Americans take for granted or don’t realize what undocumented people really have to suffer through just for the chance of providing for their families. It was surreal to film a scene in a detention center because obviously you want to be respectful and not go too off tone because of what the subject matter is, but we also need to do the comedy bits because we are first and foremost a comedy.”

When the Superstore writers decided last season to move Mateo’s story in this ripped-from-the-headlines direction, they knew they were writing themselves into a corner. Although Superstore excels at weaving societal narratives into its fictional tales, Mateo’s illegal status posed a new challenge—the possibility of a fan favorite character disappearing for a while, if not forever. But after deciding in the second season to make the queer Filipino store associate undocumented, they knew it was only a matter of time before Mateo had to confront possible deportation.

“In previous seasons, it’s something we lightly address and make it just a fact about Mateo without overwhelming stories,” said co-showrunner Gabe Miller. “But we do want the show to feel like it is taking place in the real world. We felt we had pretty well explored the area of him keeping his undocumented status a secret or being worried that someone would find out. The more the topic was in the news, the more it did feel like it was the time to take it on. It seemed like a good challenge, though it was a little scary, to see what would happen once his status was out in the open.”

Originally, the writers intended to have Mateo detained earlier in the fourth season but the timing didn’t feel right, said co-showrunner Jonathan Green. “It took a while for us to figure out how we do that in an episode of a sitcom—and keep the show funny without suddenly doing a very special episode kind of thing. We ended up deciding that it would play better as a finale where it could be a cliffhanger. It’s giving us a whole new category of stories to tell about him because now he’s not just somebody with a secret. Now he’s someone going through the deportation process, which could stretch for years.”

The breakthrough came as the writers researched how Cloud 9 employees would strategize a union drive, another complex topic the workplace sitcom began tackling last year. With help from Define American founder Jose Antonio Vargas, who spoke to the writers about his journey as an undocumented immigrant, and an American Civil Liberties Union lawyer, the writers figured out how ICE would figure into the story: With Cloud 9 employees already moving towards unionization (despite their manager Amy’s initial resistance), the writers learned ICE’s worksite enforcement program is a tactic companies sometimes use to bust unions.

In last season’s finale, “Employee Appreciation Day,” Mateo was picked up after Cloud 9 executives, who want to halt the union plans, called ICE. “It seemed like an organic way to combine those two storylines in a somewhat surprising way. People don’t necessarily know that corporations do that, so hopefully it didn’t play like we’re making up this evil thing that they do,” Miller said. “We wanted to be responsible and get it as right as we could.”

The final moments of the episode were so intense that Santos says it didn’t feel like the cast was acting. “When the ICE agents are chasing Mateo, it was really terrifying,” said Santos, who emigrated to the U.S. at 15 and whose parents were undocumented for several years. “You forget where you are and you just get lost in the moment and you’re genuinely scared for your life. When Mateo was carted away in the van, I remember looking up and seeing the sea of Cloud 9 employees crying. I thought, People aren’t acting in this one. They are genuinely affected by the reality of the situation.”

The Cloud 9 team trying to sneak Nico out of the store. Photo: NBC

When it came time to break stories for the fifth season, the writers debated whether to show Mateo in detention. They decided against dwelling on his experience at the detention center because it was impossible to find comedic beats that resonated in those moments. “There were a lot of discussions about how to walk that line,” Green said. “We wanted to do it in a way that we can get back to the show that Superstore has always been and people want it to be and still honor what happens in this kind of situation.”

Mateo has been gone a week when the fifth season opens, and his co-workers are not handling it well. Dina (Lauren Ash) hatches a ludicrous plan for her, Marcus (Jon Barinholtz), and Garrett (Colton Dunn) to dress up as decoys Mateos and sneak him out of the detention center through a sewer, while the rest of the crew focuses their anxiety on staging a war against the store’s new robot. Viewers don’t see Mateo until the last few minutes of the episode. “We didn’t want to tell the story of getting back quickly to the store,” Clarke said. “We wanted to give him a beat to make that part feel real. He wouldn’t just get out. But we also wanted to make sure the episode wasn’t crazy heavy, so we have some fun and games around it.”

When Cheyenne sits at the glass partition for their visit, Mateo shares how cold it is inside and how there aren’t enough blankets and how the guards are always yelling at him in Spanish because they assume he is Latino. Cheyenne, who has avoided visiting Mateo the whole episode and finally agrees to go with Amy, counters the gloom by offering to tell him about their co-workers’ bad outfits. Mateo lights up at the suggestion, which Santos said he can relate to.

“My own sense of humor is pretty dark,” Santos explained. “For me, the only way to deal with certain things is to laugh. Life is so fucked up in our country right now. You look at it and you wonder, How did we end up in this situation? You have to be able to find the joy in the little things or you drown in it. And Mateo’s like that too.”

Although he missed performing on the Cloud 9 set with the rest of the cast, Santos said he wouldn’t give up the chance to play a character so close to himself. “I never thought I would be able to portray a character that celebrated the fullness of my identity,” Santos said. “The fact that I am a queer Asian immigrant portraying a queer Asian immigrant, I never thought I would be able to share the intersectionality of my identity in this way. It’s huge.”

Fans will be relieved to know that, as his deportation process drags on, Mateo will not be in detention the whole season. “He will be in the world of Cloud 9 and with the other characters,” Green said. “Our focus will shift to showing what everyday life is like for him with deportation looming. When you have this uncertain future, there are a lot of interesting places we can go, but he will be with the gang.”