There’s something much worse than a bad television series: a good one in the service of a bad cause. This is what has been happening with Showtime’s “Homeland.” Over its five seasons, always enigmatic and playing with ambiguity, it has devoted a lot of resources and talent to sugarcoating the work of the CIA — including its least noble methods — and to singing the praises of a war on terror plagued with errors in conception and execution, including countless violations of human rights.

“Homeland” has come to the rescue of a spy agency whose prestige was undermined during the presidency of George W. Bush. This happened not only because there were thousands of collateral victims in the campaign against violent Islamism, or because of the systematic recourse to torture as the preferred method of interrogation, but also because of howling errors in judgment and flawed strategies. The world was not made less dangerous through this, although the United States did remain safe from large scale attacks within its borders. And no doubt many in the U.S. think that fully justifies whatever excesses occurred.

Even beyond questions about its ability to act in accordance with objective criteria, the CIA yielded without complaint to guidelines from Dick Cheney and Donald Rumsfeld, who dominated the Bush administration. Today, a different group bustles around the White House. Although in theory they are very different from the Bush crowd — and more attentive to legal issues — there are some serious doubts about their substance. Torture is no longer official policy and is prohibited on paper. However, the rule of law remains a utopian ideal because of the difficulty and the lack of political will to reconcile security and ideals.

More carefully and with cleaner methods, making full use of the potential of drones, the Obama administration is eliminating terrorist targets, but at the expense of missing the targets or taking the lives of many innocent civilians. Almost like what occurred during the Bush administration. And sneering at the sovereignty of other countries, even allies, it carries out global electronic monitoring with such brazenness that it makes a mockery of their concerns. In the end, this makes terrorists out of those who, like Edward Snowden or Julian Assange, put everything at risk to denounce the excesses of the new Big Brother.

The cleverness of “Homeland” has been to know how to adapt itself each season, with calculated and deceptive ambiguity, to changes in the international situation. It has moved along a thin line that seems to avoid Manichaeism, but that at the end of the day always makes a distinction between good and evil, and justifies the use of any means necessary in the fight against evil. Technically, it’s good television. We are so attuned to the U.S. film aesthetic, and the self-criticism is so skillfully measured out, that it is easy to be led astray, and to believe that we’re being sold an objective and impartial vision.

However, in the end the message has always been clear: Serve the patriotic best interest, and condemn the enemy outright, whether it’s an enemy of the United States or one of its strategic allies in the Middle East (they often coincide). It’s not surprising that the show is based on an Israeli series. So, at the end of season two, Iran, which has taken over al-Qaida and is calling the shots in international terrorism, is presented as being directly responsible for the (fictitious) largest attack perpetrated in the United States since 9/11, an attack that flattens the CIA headquarters and leaves more than 200 dead. It was inevitable that season three would be about revenge, executed with a lot of adrenaline, but with complete success.

Today, following the nuclear accord with Iran and the emergence of the Islamic State group, the perception of Iran’s threat has diminished somewhat. And that’s why season five of “Homeland” focuses on this new enemy, and more concretely on the preparations for a massive sarin gas attack in the center of Berlin. Meanwhile, an assassin, one of the “good guys,” is eliminating with implacable efficiency the targets that his CIA boss has assigned him, whether they are a (presumed) dangerous terrorist, or a young recruiter of women for the Syrian front.

The plot includes the leak of confidential files on the Internet that show the CIA is doing the German secret service’s dirty work, which it can’t do itself without violating the law. In light of what has happened in the past few years, it goes without saying that the hackers and the journalist who released the information are viciously persecuted. Real, like life itself.

The circle is completed when a new/old enemy takes Iran’s place. The screenwriters demonstrate a remarkable ability to adapt to a changing reality, bringing Russia in to prop up the plot. This was right on cue, just as Moscow became the declared enemy in Ukraine, and was involving itself more and more in the quagmire of the Middle East through its support of Bashar Assad’s regime.

Berlin-Russia-United States. What does this triangle sound like? Exactly: like the Cold War, with its two major players in the most symbolic setting during their confrontation over hegemony. And what is the great precedent in the world of fiction? John Le Carre and his mythical George Smiley, in eternal conflict with his Soviet nemesis Karla.

It’s not a coincidence. The “Homeland” screenwriters can’t convincingly deny this source of inspiration; many decades later, their nods to Le Carre are pretty obvious. And that makes this a perfect moment to recall two excellent BBC series starring Sir Alec Guinness: “Tinker, Tailor, Soldier, Spy,” and “Smiley’s People.”

The reunified Berlin of today provides a very plausible setting for what is now known as the “new Cold War.” It’s just how the city was when it was cut in half by the Berlin Wall, with the exchanges of agents at Checkpoint Charlie or on the Glienicke Bridge — but with one difference. Now that the Soviet bloc is broken up and communism is defeated, the clash is no longer strictly about ideology; it is now also about economic and geostrategic interests. But in the final analysis, even technological advances haven’t changed the old rules of espionage all that much. To guarantee success, the fifth season of “Homeland” even throws in that old plot device that works so well in every self-respecting spy movie or novel: the mole, the double agent who undermines the foundations of the system and is capable, on his own, of tearing down the work of years and years of patient clandestine labor.

In terms of the cast, Claire Danes is a good actress and delivers an outstanding performance. She holds up pretty well in comparison to Guinness, but she transmits too much electricity. She fits in with the general tone of “Homeland,” which has to work for audiences brought up on a more frenetic film aesthetic. However, this modern aesthetic has nothing to do with the apparent coolness and self-control that Guinness brought to his portrayal of Smiley, a self-restraint that transformed into internal tension.

In the final outcome, is it even possible to imagine a series designed to promote the greater glory of the CIA that, despite its calculated ambiguity, doesn’t turn out this way? Is there any doubt here about who is the hero, and who the villain?