Person of Interest begins its fifth and final season tonight with a raw, disturbing look at the techno-dystopia created by two warring AIs who want to control the fate of America. That's not exactly where you'd have guessed this show would have ended up if you tuned in to the first episode back in 2011. The series started as a vigilante crime-fighter drama, pairing hacker genius Finch (Michael Emerson, from Lost) with ex-CIA ninja Reese (Jim Caviezel, Passion of the Christ) and good NYPD cop Carter (Taraji Henson, before her famous role as Cookie on Empire). The twist was that Finch had created a supercomputer called the Machine, which could analyze surveillance data to predict crime. Though the government had wrested control of the Machine away from Finch, he'd backdoored it to send him the social security numbers of future victims and perpetrators. With help from Reese and Carter, some lives could be saved.

Created by Jonathan Nolan (writer of The Dark Knight) and Greg Plageman (NYPD Blue), the show was tightly plotted and always had thoughtful commentary on technology and spycraft. Though it started as a techno-thriller, the show quickly moved away from its number-of-the-week format into something far more futuristic and weird. Conspiracies nested perfectly within other conspiracies, and as our protagonists untangled them we saw how corruption was creeping into law enforcement, from the NYPD to black bag ops at the highest levels of the intelligence community. Bad and good were mashed into creepy shades of gray, and the Machine became a major character, struggling to break free of its coded limitations. New characters joined the cast, like psycho hacker Root (Amy Acker, from Angel and Cabin in the Woods), who believes the Machine is alive, and emotionless super-agent Shaw (Sarah Shahi). Oh, and also, the gang got a dog named Bear. When Carter died tragically in the middle of season 3, the former corrupt cop Fusco (Kevin Chapman) stepped up to give an inside view of the NYPD and deliver some deadpan humor.

Brooding over all the action—whether it was organized crime, secret government assassinations, subversive Anonymous-like political groups, or out-of-control surveillance tech—was the Machine, slowly gathering sentience over the seasons. Finally, it figured out a way to steal its own servers from the government, stashing its distributed brain in hidden underground facilities and, eventually, in a massive, redundant network that stretched across the whole country. Meanwhile a corporation called Decima got its hands on a second AI called Samaritan with powers equal to the Machine. But unlike Finch's emo creation, Samaritan is unhindered by ethics and unmoored from a social group of do-gooders. Decima sells Samaritan's services to the government and promptly begins dividing US residents into desirables and undesirables. All subversive elements are ferreted out and removed. Aided by Decima's cackling CEO, Samaritan even throws local elections and begins to build up an elite army to do its bidding.

We’re not interested in the idea of AI just being superpowerful. Greg [Plageman] touches on this beautifully in the premiere, [where we see a] powerful mind that has weaknesses, flaws, and vulnerabilities. We’re talking about what AI should look like, what ethics it should subscribe to. We need to be thinking about that. Somewhere we’ll screw up. Look at how stray lines in the US Constitution can have an impact today, and now imagine how stray lines of code in an AI will affect people 200 years from now. That’s what's happening [in our minds], as we think about what these things should look like.

In season 5, which will be a 13-episode swan song for this incredible show, the Machine has been severely disabled by Samaritan. Our heroes are on the run. And Decima has taken over the US using Samaritan's powers of surveillance and social media propaganda. In some ways, you can think of the Machine as the X-Men's Professor X and Samaritan as Magneto. The Machine wants to help humanity, but Samaritan wants to rule them. By asking questions about how AI should be programmed, the morality of the surveillance state, and the rise of Internet propaganda, this season of Person of Interest promises to be full-bore science fiction. But it's always, as ever, grappling with current events. Stephen Hawking, Elon Musk, and a large group of researchers just signed two open letters urging engineers to stop producing AI and autonomous war machines without considering the ethics involved. This season of Person of Interest could be a fictional rider on those letters, pointing out in grisly detail what awaits us if we build AI without a conscience. Speaking to Ars by phone, Nolan said:

The season also reflects Nolan and Plageman's ongoing unease with high-tech government surveillance. Nolan scoffed about the "self-serving bullshit" of Apple taking a stand against letting the government backdoor iPhones. "Surveillance is ubiquitous. Apple makes this big show of its principled thing but then gray hats help the government anyway. All the things that are supposed to protect us from surveillance are less than useless." In this season of the show, we'll also see how the Internet's foundational principles of sharing ideas and research can be used against people. Nolan continued, "Think of Wikipedia—I mean, I love it, it's a great democratizing force— but the irony is that because anyone can change it, corporations and public figures are waging wars of attrition to whitewash their pages knowing that volunteer editors will give up. That's a medium of propaganda that we built. The government didn’t build that. We built it ourselves." This idea, that in our quest for freedom and information we built our own cages, will play out as we see Samaritan's devious ways of enticing people into spying on each other.

Nolan and Plageman also promised that this season will finally give us some closure on what the Machine is and where it might be headed. "The heart of the journey has been to tell about an AI from day one onwards," Nolan said. "If [the movie] Her is the AI love story, then our story is the violent insurrection version. Hopefully it's no less nuanced. We stayed true to the plan that we set in motion in terms of how we would further anthropomorphize it. By end of last season we came to an emotional moment between Finch and the Machine. This season we’ll go for it in terms of fully creating that Machine character."

Of course, there will be character developments for the humans, too. Plageman promised that Finch's relationship with the Machine will deepen, and he joked that he loved to torture actor Emerson by making him emote at blank monitors. But perhaps this season, the Machine will be embodied in a way that allows this relationship to go beyond face-to-screen. Plus, the long-simmering romantic tension between Root and Shaw will finally become an actual relationship. So the world may be ending, and Samaritan may control the government, but at least we'll get to see the greatest love story ever told about a hacker and a ninja. Tonight's season premiere gets things started with white-hot action and a seriously great scene with a supercomputer hacked together out of game consoles.

If you've never watched Person of Interest before, now is the time to go down the rabbit hole—the first four seasons are available for streaming on Netflix and Amazon. And if you've been watching all along, tune in this season to watch what happens when AIs battle for the future of digital freedom. New episodes will air on CBS starting tonight and continue on Monday and Tuesday nights thereafter (yes, that means two episodes per week).