After eight seasons, 96 episodes and countless threats to the United States, “Homeland” airs its final episode on Sunday (7 p.m., Showtime).

It’s not too soon. An argument could be made that it’s about six seasons too late.

Make no mistake — the first two seasons of “Homeland” were great television. Based on the Israeli series “Prisoner of War,” the story of CIA agent Carrie Mathison (Claire Danes) and her efforts to stop U.S. Marine Nicholas Brody (Damian Lewis) — who was turned into a sleeper agent/terrorist while being held captive by al-Qaeda — was riveting. The characters were incredible, the twists were astonishing.

Several years later, the parts that I thought strained credulity seem perfectly plausible, given all the real-life developments that we’ve seen in the past few years.

But cracks began to appear in Season 3 when Brody — who certainly should have been either imprisoned or killed by the end of Season 2 — returned. It was a classic case of producers who kept a popular villain around even though his continuing presence undermined the show.

Sort of the way that bringing Sylar (Zachary Quinto) back for Season 2 of “Heroes” was the beginning of the end of that show.

Fortunately, executive producers/co-creators Alex Gansa and Howard Gordon corrected that mistake by killing Brody at the end of Season 3. But the damage had already been done. Seasons 4-8 of “Homeland” have been watchable, sometimes very good, but they’ve never recaptured the magic of those first 24 episodes.

Or, maybe, “Homeland” is just one of those shows that couldn’t go on forever because of the stakes involved. If anyone has experience with that, it’s Gordon and Gansa. They were both executive producers of “24,” a show that eventually collapsed because — honestly — how many times could one character save the world? Jack Bauer (Kiefer Sutherland) became less character than caricature.

And, for eight seasons, Carrie Mathison has been at the center of one civilization-threatening crisis after another.

To some degree, Carrie avoided that same fate as because she was a deeper character. And she has a flaw — she’s bipolar, which has been a part of the character since Day 1.

(Richard Shotwell | Invision/AP file photo) Mandy Patinkin, left, and Claire Danes participate in the "Homeland" panel during the Winter 2020 Television Critics Association Press Tour on Monday, Jan. 13, 2020, in Pasadena, Calif.

But not that long before Day 1. According to Gansa, Carrie was not bipolar when the script for the pilot episode was written. Showtime executives urged Gansa to make her “more premium cable” and “not just Chicken Little who was screaming that the sky was falling down every week.”

Gansa credits his wife with alerting him to bipolar illness, “and it seemed like a very natural fit for this character. So, in the next draft, Carrie Mathison became bipolar.”

Danes said she was “always anxious about it being treated as a gimmick,” and readily admits that the show had to “take liberties” with Carrie’s condition to serve the narrative.

“Look, there was a lot of poetic license here,” she said, “but I also think that we were careful to refer to authentic experiences. And we all did a lot of research, and we all took it really seriously.”

When “Homeland” premiered in October 2011, it was rather revolutionary simply because a woman was at the center of the story. This is the sort of role that has generally gone to a man.

“I was just so relieved when I got this script to find a character that was driving the story forward, whose choices were really meaningful,” Danes said. “She wasn’t just responding to a central character. She was the central character.”

In the final episodes [SPOILERS IF YOU HAVEN’T WATCHED ALL OF SEASON 8], Carrie is trying to prevent a U.S.-Pakistan war. She’s got to make a deal with the Russians to recover a flight recorder that proves the president of the United States was killed because his helicopter suffered mechanical failure — it wasn’t shot down by terrorists.

We’re promised that Sunday’s series finale will give fans closure. That we’ll reach a conclusion to the relationship between Carrie and her mentor, Saul Berenson (Mandy Patinkin). And that it will be the end of “Homeland.”

What about, maybe, a “Homeland” movie somewhere down the road? “It’s certainly a possibility,” Gansa said. But “not now. I need a break.” Gordon responded: “Never say never."

What would that movie look like? “We do joke about ‘Homeland: The Musical,’” Danes said.