It was the end of an era on Criminal Minds Wednesday, when Shemar Moore exited the series after 11 years — a departure that was one whole year in the making.

"It's such a weird thing now that it's over because Shemar and I talked about this a year ago [when his contract was up]," executive producer and showrunner Erica Messer tells TVGuide.com. "It was a difficult thing to keep under wraps and CBS had a plan in place where they very wisely said, in an age where there are no secrets — there are spoilers everywhere — 'Wouldn't it be nice if we could keep this a secret?'"

According to Messer, the network pointed to Josh Charles' top-secret, shocking exit from The Good Wife — which coincidentally aired two years ago to the day of Moore's exit — as a model to not announce Moore's departure. "They really looked to that and wanted to make it an event," Messer says. "There was definitely speculation ... but I think keeping it under wraps for the most part was the way to go because it really did have an impact. My family was texting me, like, 'What's happening? What you mean? How could you not tell us this?!'"

Shemar Moore on his Criminal Minds exit: "I'm proud of the way things ended for Derek Morgan"

Unlike Will Gardner's fate on The Good Wife, Derek Morgan left the BAU alive, embarking on his new life as a father to his new son, Hank Spencer, with his wife Savannah (Rochelle Aytes), after taking down Chazz Montolo (Lance Henriksen), who targeted Morgan to avenge the death of his hit man son Giuseppe.

Check out the rest of our interview with Messer to see why she refused to kill off Morgan, what you didn't see in the episode, and whether he'll be replaced.

How does it feel now that everyone knows?
Erica Messer:
Now we can talk about it! It was hard to have conversations with you and not be able to say, "Oh my God, this massive thing is going to happen this year." I knew you kind of knew and I know people suspected it, but it was weird not to be able to talk about it. But I think it was a good call [to keep it a secret]. ... Surprises are great, even if it's a bittersweet one. It was definitely great to see our fans as engaged as they were last night. They are every week, but especially with these last three with Derek in jeopardy. It just proves they love our heroes so much.

I talked to Shemar and he said you convinced him to stay another year to give Morgan a proper farewell for the fans, and he said he hugged you at the wrap party and said, "You kept your promise." How did you go about planning the Dirty Dozen arc that eventually turned out to revolve around him?
Messer:
When I talked to Shemar last year, negotiations had started with the actors and he said, "I don't want to come back," and I said, "That's not OK." [Laughs] "I'm not OK with that for many reasons." I support him and his decision to leave. We all do. We want him to be happy and go on and do great things. But as a fan of the show myself, I couldn't fathom the idea of that character just not showing up or not being there suddenly. It just didn't make sense. The initial talk was [him doing] just six episodes. I said that didn't feel like enough either, and everybody eventually settled on the number 18. What that allowed us to do is what we always do: We introduce you to bad guys and we stop the bad guys. And we were able to do that for the first more than half of the season, but we had this underlying arc of the Dirty Dozen. ... That was Breen Frazier's brainchild and he set up an interesting story where we think this is a Garcia (Kirsten Vangsness) story, but then we put that to rest by "Entropy," and that episode was a Reid (Matthew Gray Gubler) story.

It was a good touch to have Garcia and Reid be "in danger" initially since those are the two people he's closest to.
Messer:
Yes, exactly. When we started coming up with "Derek" and the 250th and "A Beautiful Disaster," I said, "I think this is revenge and I think it's Montolo's dad." What we had built in so nicely with Shemar and the Danny Glover episode was a story about a man whose father was taken from him so early in his life that everything he did from that point on was a path that maybe he wouldn't have taken if his dad had always been in his life. You never know, but Derek Morgan became such a protector and I think he did that because he lost a protector in his father at such a young age. We knew we wanted Savannah to be pregnant so that Morgan could leave with the opportunity to be a dad. This whole thing of fathers became a theme, so that's why it made sense with Montolo — his father blames Morgan for his death. Morgan's like, "I didn't poison the guy," but [Chazz] is like, "No, but you arrested him, which put him in prison and that got him killed." ... And then Morgan turns it on him and says, "You weren't a good father because you could've made choices that didn't put your son in the kind of line of work he was in, which means he never would've been arrested and he wouldn't have died." It was that whole journey of Morgan realizing the roles fathers have in people's lives, good or bad. And for him to survive and his wife and child to survive, it felt like if Morgan didn't walk away right now, I'd be mad at him. [Laughs] It just feels like you have to go be a dad to that little baby.

It was purposely written that the door's always open. Everything the characters say to him was really us talking to him, whether it was me and Kirsten, or me and the writing staff, or me and the cast and crew saying, "We're always here for you." We hate goodbyes, we hate change, but oh, my gosh, we've had so much of both of those in our 11 years, and it's not always a bad thing. And it isn't. We've dealt with a lot of that change. I think we've always done well in moving on and adapting and growing. Those little moments were all of us talking about Shemar leaving, but masked in Derek Morgan leaving.

It was a full arc just for the character because he was always the cool single guy and now he's choosing his family, something maybe he never thought he might have and didn't have completely growing up. I know some fans thought you might kill him off, but I think that would've been too cruel.
Messer:
Yeah. He suggested it, like that could be a really great, amazing episode. I was like, "No way, no way, no way." I look at him as a friend, even the character. From a writing perspective, a fan perspective, I need to know Derek Morgan is still out there in the world. He's just not there with us right now. He's fine, he's living his life, being a dad and going to the park, and everything's good. I think that's me sort of wanting to write a happy ending, but the world feels a little safer with our heroes in it. It took us years to kill off Mandy Patinkin's character [Gideon] because it seemed like, who knows? Maybe one day we can get him back to guest star. And that became less and less of a possibility and it was like, OK, you know what, that could be an amazing story to tell in Season 10. He gets murdered and we had [Jennifer] Love Hewitt on, who never worked with Gideon but had heard about his legend and all of that. It was a fun way to honor our team after 10 years to say, "These things happen." The last time you see somebody, you never think it's the last time you're seeing that person.

25 times Morgan and Reid's Criminal Minds' bromance was the best

I think that's more realistic. For shock value, deaths are more fun on TV, but in real life people just move on. They leave jobs, start anew.
Messer:
Exactly. I would argue, having worked at this show for 11 years, it's not the norm for anyone anymore to be at one job for this long. When you look at the FBI version of that, it is unusual to have this team of people be the only ones to do this job for 11 years. Obviously we've had people come and go, but as a whole, that team has been intact, and that's amazing and wonderful. But the realistic version is people would come and go and consult, maybe run their own field office in another city or whatever. That's what I want Season 12 to be about if we get picked up — sort of embracing that idea of "We were so lucky to have 11 years of that and now it will look a little different, but we'll be OK."

Shemar said 17 minutes were cut from the episode. What was in those 17 minutes?
Messer:
Oh, I know. That's always so hard. You know when you're filming it when it's running a little long. I never saw the cut that was that long because the editor gets his eyes on it first and his job is to get it as close to time with the director — who was, as you know, Matthew — without lifting scenes. ... There was a great scene with Aisha [Tyler] and Shemar. It got truncated to her coming in with the juice and cookie. She has this whole theory of what's going on and he says, "Just so you know, I got kicked off the case, but I'd love to hear your theory." Then the scene continues with Hotch (Thomas Gibson) and Rossi (Joe Mantegna) coming in to say they have a suspect. Aisha and Shemar are really good together. We made sure everybody had a scene with Shemar that was a one-on-one scene, but we lost a majority of that one.

We lost a lot of Shemar talking to Savannah and the baby at her bedside. I think that was a four-minute scene. Instead, it was to the point, which was, "I'm so sorry, this should be me right now," which, I think, was the core of what that scene was about. At one point it wasn't in there and we had stayed outside the room, and Shemar asked if we could put some of that back, and we did. It's just these little moments of him with each of them [that were cut]. There was a bigger buildup to him snapping at Garcia about her blind optimism. She had a lot more to say there. It's one of those things we miss it because we know it was there, but I don't think audience would miss it because we still managed to tell the whole story in 43 minutes.

Do you have any replacement plans right now?
Messer:
It's such a bigger conversation with the network and executives. I would really love to lean into this idea of having people come in to consult. How great if we could get Shemar to consult once in a while? Paget [Brewster] is back next week. It was so great to have her back. We'd like to make more of those creative choices. The challenge is if they have other projects, it's more difficult to make that happen. This year, we were hoping to have Paget in the premiere, but she was doing Grandfathered. Grandfathered wrapped in February and we grabbed her and had her play with us for a week. But I don't really know. There is no replacing Derek Morgan by any means. We'll need to see who might come play for a while. It's hard to be the new kid and we've seen it a lot. We've seen a few characters come and go. It's a hard gig. I think Aisha's done an amazing job this season. So it's a conversation that we have not really pursued any further. Now that everyone knows, we can sort of all be on the same page and settle in to that for a minute before we figure out what we're doing for Season 12 — fingers crossed since we still don't have a pickup for that.

Reid has had a lot of growth this season. He usually has a hard time with change, but he understood. It's the kind of emotional awareness we don't see from him a lot and it started last week when the roles switched and he gave the pep talk to Morgan. Are we going to see him get over this more quickly?
Messer:
I think he's still going to be really affected. I think that is the character. He is so intelligent and he plays it forward and backwards a million times. He was definitely affected when Gideon died because Gideon was the one who brought him into the BAU. He had a connection there. Morgan was his best friend on the team. He will be affected in Episode 19. They all miss him. It feels like it's the first case they've done without him. But there's the happy distraction of having Paget back. We will play what it is to not have him there. Prentiss speaks to the fact that he's probably having a hard time too because she knows. It isn't easy to walk away from this group. And there are some nice moments with her at the end with the whole team.

Are you going to miss writing "baby girl"?
Messer: I will. I feel like we have to mourn that for a second and we do for the rest of the season. Kirsten and I touched on that a little bit when we were writing the episode. Garcia should be mad a little bit. ... There's sort of a madness that comes when someone leaves. I feel like there's not one emotion when something like that happens. You might have good days and bad days with it. Garcia makes little jokes, like, "I hear they're moving someone into his office. I'm going hate that person." ... But I think that's real. I've dealt with that in a work environment before. There will be no one that fills that role of calling her "baby girl" unless they do it in fun. But I also think it's an opportunity for Garcia to grow. She remains such an anchor for us. She is manning the ship at home. It will be one of those things that has made her who she is, but she is so much more than baby girl and it will be nice for her to show us that, even though there isn't a call to him on the other line.

Criminal Minds airs Wednesdays at 9/8c on CBS.

(Full disclosure: TVGuide.com is owned by CBS.)