For “Homeland” to do what it does best, Carrie Mathison had to become Nicholas Brody in the show’s eighth and final season.

Alex Gansa, co-creator and showrunner of the Showtime drama series, realized the storytelling path for the swan-song year as they were filming the closing scenes of Season 7. Claire Danes’ intrepid, bipolar CIA agent would come full circle by finding herself under suspicion of having become a brainwashed double-agent turned by the enemy — in this case, Russians — after she spent seven months in a spy-gulag during Season 7.

“Not only is she being suspected, she’s suspecting herself,” Gansa tells Variety.

In the season that debuts on Sunday, Carrie’s latest mission involves trying to reconstruct her repressed memories of her time in captivity. Gansa and his team have to deftly place the last figurative pushpins and yarn on Carrie’s signature evidence wall to make the case for “Homeland” standing the test of time as one of the great drama series of an era that has no shortage of contenders.

The 20th Century Fox TV-produced series that debuted Oct. 2, 2011 has ridden the wave of real-life headlines and earned the respect of many who work in the deep-state intelligence and national security sectors. At its peak, “Homeland” counted the previous occupant of the White House — President Barack Obama — as a big fan. For almost a decade, “Homeland” has been a cornerstone of Showtime, and the only series to date from the ViacomCBS pay cabler to claim the top drama series prize at the Emmys, for its first season.

As her story draws to a close, Carrie will endure the same skeptical probes from her intelligence community peers as she waged back in season one against Brody, the ex-Marine sergeant played by Damian Lewis. Brody was in fact turned after being held prisoner by Al-Qaeda for eight years — until Carrie turned him around again.

In the waning minutes of Season 7, a physically and emotionally battered Carrie is returned to her CIA mentor Saul Berenson (Mandy Patinkin) as part of a prisoner exchange. As “Homeland’s” globe-trotting crew captured those scenes on location in Budapest in March 2018, Gansa had a revelation about the show’s ending.

“I knew in that moment her captivity would become an open question at the beginning of Season 8,” he says. “All of a sudden she was in Brody’s shoes.”

The storytelling engine for the final season is, as ever, a means of allowing the “Homeland” to explore its central themes: What have we learned from 9/11 and how has it changed us?

“Those questions kept getting more and more interesting” over the seasons, says veteran showrunner Howard Gordon, who co-created the series with Gansa (by adapting the Israeli format “Prisoner of War”). “I think the DNA of this show was remarkably durable and expandable in ways we couldn’t have understood 10 years ago.”

(L-R): in HOMELAND, “False Friends“. Photo Credit: Sifeddine Elamine/SHOWTIME.

“Homeland” has excelled in showing the human costs of the post-9/11 War on Terror. It’s explored the cottage industries and political power bases that cropped up around the counterterrorism movement. It has, at times, cast a harsh light on the U.S. government and its activities in dark corners and faraway places. And the show has come in for criticism of its own for what some feel is a stereotypical depiction of Middle Eastern life and culture and an over-reliance on Muslim characters as villains.

The fact had the show had the power to spark controversy and conversation is a testament to the nuanced work the Gansa has steered with a top-flight team of lieutenants over the seasons that includes executive producers Chip Johannessen, Lesli Linka Glatter, Meredith Stiehm and Alexander Cary. Gordon has come in and out of the show over the years as he also juggled other projects. Gansa and Gordon have worked on many shows, together and apart, but the “Homeland” experience has been sui generis.

“The show’s been an amazing opportunity to experience fictionally some of the crazy new-normal that we’re finding ourselves in,” says Gordon. “It’s had a relationship to the world that we’re living in.”

The goal from the start has been to “make sense of the contractions and conflicts and debates about how America was choosing to project its power overseas,” Gansa adds.

The core “Homeland” team famously took annual field trips to Washington, D.C., to meet some of the characters’ real-life counterparts for research before writing each season. That process gave the show a currency that couldn’t be bought. Those conversations allowed producers to zero in early on conflicts in Syria, Iran, Pakistan and the rise of cyber-terrorism, fake news and digital demagogues. The head start from the show’s own intelligence-gathering operations allowed the show to portray issues on screen often as they rolled out in real-world headlines.

“We weren’t prescient. We just heard this stuff before it became public,” Gansa says. “It was really remarkable and we have always extended a tremendous amount of gratitude to the people who opened up to us in Washington.”

Given the show’s track record, cast and crew felt enormous pressure to deliver a strong final season. At times, the strain did show, Gansa admits. The decision to set much of the final season in Afghanistan — which meant shooting in Morocco — added to the complexity.

“Geographically it was difficult year [for shooting] and it was also emotionally difficult for everybody,” Gansa says.

“We put a lot of pressure on ourselves to make the last season good and meaningful and as satisfying as it could be. That led to a few more disagreements than usual among the principles about where we were going and why we were going there. Everybody felt strongly about a lot of things,” he continues. “I think some of it came down to — breaking up is hard to do.”

In reflecting on the show’s evolution, Gansa says he’s convinced that a big part of the reason why “Homeland” took off for Showtime was because of its timing. The premiere that came less than a month after the 10th anniversary of the 9/11 attacks on New York’s World Trade Center and the Pentagon.

“The series has always been a meditation on how America reacted-slash-overreacted to 9/11 and how we’ve conducted the war on terror and how the counter-terrorism industry has changed our country,” Gansa says. “Because 10 years had gone by, we hoped people would be able to look back and assess where we were in a way that they wouldn’t have been able to if we’d come on one or two years [after 9/11]. But 10 years later I think our audience was able to accept the questions we were asking.”

Although the tragic love affair of Carrie and Brody was the central storyline of the first three seasons — unexpectedly, but the chemistry between Danes and Lewis was too sizzle-y to ignore —  the beating heart of “Homeland” has always been the protege-mentor relationship between Carrie and Saul. Gansa and Gordon can’t find enough superlatives to heap on the work of Danes and Patinkin in those roles, from the first day of shooting on the pilot in 2010 to the hugely emotional conclusion of lensing last year.

“Every day, everybody working on this show brought their A-game, and that started with Claire Danes,” Gansa says. “Her generosity for every other actor who came on this show made ‘Homeland’ a unique and special and extraordinary experience. Every single season we left everything on the court behind us with no regrets.”

For Gansa and Gordon, who started their careers as writing partners and formally reunited last year under an overall deal at Sony Pictures Television, “Homeland” is sure to be a high-water mark no matter what the future brings.

“It certainly was a culmination of a certain level of creative maturity for us at this time in our lives,” Gordon observes.

Gansa stayed at the helm through all eight seasons simply because he couldn’t hand his progeny to another showrunner.

“This show was ours. We created it, we cast it, we fought the good fight all the way through,” Gansa says. “Most of the shows I’ve worked on, I’ve been working for somebody else. It took a lot of people to build it, but we laid the first bricks. That makes the journey different. I felt I owed it to the other creative people involved to stick with it the whole way.”

With the final season about to unspool, Gansa and Gordon have been persistently hit with the S-word question — would they ever consider a spinoff? Sequel? Or even a prequel?

Gansa’s response is a blend of a heavy sigh and a repressed groan. Gordon, like all good partners, is able to finish his collaborator’s unspoken sentence.

“The answer is never say never,” Gordon says. “But it’s a bad time to think about that question. Nothing’s impossible, but there are no plans. Alex can’t even talk about not talking about it.”

Pictured: Alex Gansa (top) and Howard Gordon (above) on location during “Homeland’s” final season.