Warning: Spoiler alert! Do not proceed if you have not watched Tuesday's episode of Animal Kingdom. You are about to enter major spoiler territory.

Animal Kingdom was just hit with its biggest loss.

On Tuesday's episode, titled "Ghosts," the TNT family drama said goodbye to Janine "Smurf" Cody (Ellen Barkin), the tough matriarch of the Cody boys, whose death came not during a heist gone wrong -- like we all may have presumed -- but by a fatal shot taken by her grandson, J (Finn Cole). For four seasons, Smurf's tension-filled relationships with her sons have caused strife for years, with several of them crowing about going off on their own and stepping out from under her shadow. But without her around, will they even survive?

Diagnosed with terminal skin cancer earlier in the season, Smurf was forced to face her own mortality for the first time. And when she decided to pull one last heist, she had plans of not making it out alive -- only Pope (Shawn Hatosy) had other plans. "I'm supposed to be dead," Smurf snarls, after Pope safely rescues her from a bloody gunfight she starts. That's what leads her to break down in front of her sons in the episode's most heartbreaking and gut-wrenching moment, when she pleads with Pope to do the unthinkable and shoot her dead. Her desperate pleas and Pope's insistence on not being the one to kill her prompts J to be the one to pull the trigger. 

Following Animal Kingdom's bombshell episode, ET spoke with showrunner John Wells about the decision to kill Smurf, the conversations he had with Barkin about wrapping up her storyline, the ramifications of her stunning death for the Cody boys and how the loss of the family matriarch sets up next week's emotional finale and the upcoming fifth season.

ET: This is a big episode of Animal Kingdom. When did you first get the feeling that this was going to be it for Smurf and that she was going to die?

John Wells: We start every season in the writers' room before passing out index cards to all the writers and I ask different questions: What did we do well? What didn't we do well? What are the scenes that you want to see more of? What are the scenes you don't want to see more of? One of the things that showed up a lot was we felt like the stories of Smurf's dominance of the boys were becoming... not predictable exactly, but expected. And it led to a conversation of, "What do we do to not repeat the same dynamics?" One of the things that came out of it is, how did Smurf become Smurf? Who was she? We only know little bits and pieces of it, and that led to the storyline of a younger Janine, the birth of Julia and Andrew, and the history with J. And we didn't want to end up at the end of the series and not have seen how the boys would actually survive without Smurf. It's the animal kingdom, so every couple of years someone is going to leave the show -- either one the characters is going to get killed or arrested permanently to keep it realistic. 

We kept coming back to the fact that if Smurf died, who would the boys be? How would they survive? What would happen next? Would they survive? Would they fall apart? Would they come at each other's throats? Would the family hold together? The more we talked about it, the more excited we were about being able to have Ellen work through the year with this. Smurf is not somebody who can easily accept her own death and isn't about to go out in a hospital room with an IV having wasted to nothing. I've done a lot of shows in which characters have left, oftentimes the actor has wanted to do something else and that wasn't exactly the case in this, but [Smurf's death] leads to great storytelling. You have to have people coming and going to be able to shake up the dynamics of the relationships between the characters. 

What were those conversations that you had with Ellen about Smurf's arc? Did you tweak anything with her storyline as a result?

I spoke to her very early on before we came back for the season to talk about it. She's a movie star, so she's used to doing three months on a show or on a film and then going off and doing something else. So she was amazed that there was four years worth of work, so it wasn't that. She was like, "Yeah, these people have to die." 

One of the most intense moments comes when Smurf is pleading with the boys to spare her and she basically demands Pope to be the one to pull the trigger, but he refuses. Instead, it's J who pulls the trigger. What was the thinking behind having him be the one to take the fatal shot and was he always going to be the one to do it?

No. We had endless conversations about who should pull that trigger. Three or four episodes before we actually gave the script out, the actors were aware that this was going to happen but they didn't know who was going to do it. So I got the actors lobbying, "I should be the one to do it," or, "You should be the one to do it," because they knew that whoever pulled that trigger was going to set a series of actions in motion for the future. They understood at the moment that Smurf was committing suicide because she didn't want to die [in a hospital bed], so it's not a murder necessarily, but it's who had the courage to actually do what she wanted done. The ramifications of that and the recriminations for the future were going to become major story points for next season. There's already quite a bit about that in the final episode, but it'll be something that propels us into next season substantially.

Ever since Smurf was diagnosed with cancer earlier this season, she's been forced to face her own mortality quite literally and not through the family business by pulling off heists and dealing with dangerous people. It offered insight into a character that we rarely see vulnerability from. Can you talk a little bit about her journey this season?

When we get into these issues about our own mortality and death, even if a character like Smurf is someone you have complicated feelings about, where you're not sure if you like her or not, it's impossible to have to watch anybody having to confront those decisions without it becoming personal. I think all of us, at first, assume we're immortal, even though you intellectually know that you're not and there will be a moment where you have to face these things. How do you know when that moment is? Is it valuable to stick around for a long period of time if you're ill? What's the weight of that for the rest of your family to have to witness that? Is it selfish to go out into the woods and shoot yourself and save everybody the trouble? All of those issues are universal and we were able to tap into those emotions that we all have in thinking about [death], even with a character who can be as reprehensible as Smurf. It's real-life stuff, even within this heightened world of what Animal Kingdom is. And it will sneak up on you. It snuck up on me when I was writing [the episode] -- that wait a second, this is something we all are going to have to deal with at some point in our lives with our loved ones but also with ourselves.

We see the boys each reacting to Smurf's death differently. What are the ramifications of the Codys losing their matriarchal figure? How I'm reading it is she was the nexus of the family and without her, there's a real threat of them continuing to splinter.

That's exactly where we're headed. They've been sitting around thinking, "Boy, I wish Smurf wasn't here because she controls me so much and there are so many problems." And then she's gone. And then you're suddenly like, "Wait a second, there was a lot of stuff I wanted to say. There was a lot of stuff I wanted to know that I never asked about." There is a void, even if you hated the person, even if their connection with you was complicated and you felt damaged by them. That's a lot of what next year will be about. Is there a center without Smurf and can it hold? Can they hold their relationships? Can they continue to work together? She raised them in such a way that they felt they couldn't live without her. Can they?

In an earlier episode, Pope threatens J, telling him pretty pointedly, "When Smurf's gone, so are you." The tensions seem to be coming to a boiling point between the two. Is a blowup simmering?

Oh yeah. That's what the last episode is about in large part. Will they stay together at all as a family? That's really the tension that holds the final episode together and what we think will propel us into the next season. That's very astute. That's exactly what, thematically, is happening in the final episode.

At the end of this episode, Deran makes the declaration that he and Adrian are going to peace out of Oceanside, confirming that in his mind, this is the only way out for them. I have a hard time believing it's going to be that simple for them to get out...

If the A plot [in the finale] is what happens with J and Pope, the A-minus or the other A plot is about what happens exactly with Deran and Adrian.

Since you directed this episode, what scene was the most challenging or most emotional to film?

The final scene where Smurf is shot. It's an emotional scene in the way it was written, but that's a very difficult scene for the actors, for particularly Ellen and Shawn. As a director you're wondering, "All right, how much am I going to have to provide to get them to the point where they can really do it if they come and they're not really there?" And they both showed up ready to go. With Ellen, she's such a wonderful actress, I don't think we ever went past three takes on any of those shots. She knew exactly what she wanted to do. Shawn, who wasn't sure what she was going to do, as Pope started reacting to what she was doing and it got extremely powerful to be on set. 

The finale episode is titled "Smurf." Will we see a funeral or a service? What can you preview?

It's more about the aftermath of the matriarch's death and how does that affect all the boys, but it's also about Smurf as a younger woman with her babies [Julia and Andrew]. Where is she going to land? What happens next after everything that's happened to her, and it's the start of what we plan to play quite a bit of next year. Seeing how Smurf became Smurf as a young woman, and how she became who we know her to be because the audience already knows who she'll become.

So season five will be interweaving the boys' stories in the present-day dealing with the aftermath of Smurf's death with flashbacks to the 1970s? 

Yes, and probably in the same mixture that we had this season.

Is the door still open for Ellen to return in some capacity if the story calls for it?

It's a combination of do we have an idea that would be enticing enough for her to get to do something she felt she hadn't done yet on the show to return? And then what her availability is. She's a very in-demand actor. My thing is never say never. It really depends on whether we come up with a story that makes sense within the context of what we're doing and one that's compelling enough to make her want to come back. You never know.

Emily Deschanel has really done wonders as Angela this season. With Ellen's departure, could she potentially fill at least part of a void left by Smurf?

I don't think an actor or character could actually take the place of Smurf, but I thought Emily did an extraordinary job with that character. I had auditioned her years ago before she did Bones and knew how much range she has. When our casting director, John Levey, suggested Emily for it, I said, "Oh yeah, she'd be fantastic if she wants to do it." I think for others, they have been surprised. I think there are things to do with that part if she wants to continue to do episodes in the future, but it was a real pleasure to have her around. 

How would you describe next week's finale? 

We kind of described it when we were shooting it as if there had been a bomb blast and everybody had been hit by the concussive shock wave, their ears are bleeding, they are dazed and are trying to find their equilibrium again. It's the absence of an extraordinary power and who am I now? Who are we now? So that's what we were trying to do. You'll tell me if we did it successfully or not.

The season four finale of Animal Kingdom airs Tuesday, Aug. 20 at 9 p.m. ET/PT on TNT.

RELATED CONTENT:

Emily Deschanel Gives J a Piece of Her Mind in Tense 'Animal Kingdom' Sneak Peek (Exclusive)

'Animal Kingdom' Star Shawn Hatosy on Making His Directorial Debut (Exclusive)

'Animal Kingdom' EP on Season 3 Premiere's Heartbreaking Reveal (Exclusive)