The erstwhile star of “The Good Wife” knew for months that his lawyer Will Gardner was doomed to die—and no one spilled the beans.

“I’m pretty good at keeping secrets,” he admits with a laugh. “It was a collective team effort, from the network and the producers and our background performers. You would have thought somewhere along the way someone would have slipped up. And they didn’t, because everyone knew the surprise and the shock was a big element of it.”

Shock is putting it mildly. When Will Gardner died in the 15th episode of the show’s fifth season, the response was immediate and loud. While some fans and critics argued that it was an arbitrary decision, the choice was met with hails of critical fervor by most, all part of the show’s renewed resurgence in its fifth season—one that in retrospect is melancholy, because Charles was at the epicenter for so much of it.

Betrayed by former lover and co-worker Alicia Florrick (the titular wife, played by Julianna Margulies) when she left his law firm to launch her own—taking with her some very lucrative clients—Will cycled through all of the emotions of grief, lingering particularly long on anger.

“Leading up to this year, I knew we were heading into some interesting terrain, both with Alicia leaving the firm and they were taking Will to some intense places,” Charles says. Some of that was no doubt due to the writers wanting to give Charles something particularly meaty to go out on; the actor spoke to showrunners Robert and Michelle King last year about leaving, wanting to give them plenty of time to adjust to a Will Gardner-less show.

“It gave them enough time to really think about it and really plan the story and the arc really clearly,” Charles says. “I always wanted to do that because this show has been so good to me, and me wanting to leave had nothing to do with the show, just me wanting to have new creative experiences. I wanted to do anything I could to help it tell the best story we could tell. And I’m glad I did because this year has been an exceptional year!”

On any other show, a lead character’s dramatic and shocking murder would surely be the high point for an actor—but the fifth season was particularly good to Charles, who was served juicy material week in and week out. And no episode was a better marriage of actor and script than in the show’s 100th episode, “The Decision Tree,” in which Will outlines all the possible permutations of questioning Alicia on the stand—ultimately deciding to be as brutal and ruthless as necessary to win.

“What the writers do so well on this show is walk this ethical tightrope,” says Charles. “No one is really one thing or another. You may be pulling for a character in one moment and repulsed by their behavior in the next. So for me, what was interesting about ‘The Decision Tree’ is it was a moment when you got to see under Will’s armor. You see for a very brief glimpse into the real raw emotion that’s underneath all of the anger and rage. And then the armor’s there again.”

As for leaving behind “The Good Wife” and Will Gardner, Charles is content with the way things played out. “I can’t imagine doing it any other way now. It’s been a hell of a ride and it’s been capped by this season,” he says. “I felt so honored and humbled and really thrilled to be a part of it.”