Warning: SPOILERS for Foundation episodes 1 & 2.

The dramatic Foundation episode 2 ending launched Gaal Dornick on an unexpected journey - and set up the fall of the Galactic Empire. Inspired by the novels and short stories of Isaac Asimov, David Goyer's Foundation brings a sprawling sci-fi epic to the small screen. It introduces viewers to a distant future timeline in which humanity had long since left Earth, establishing an empire that spanned the entire galaxy. Like all the best science-fiction ideas, the story is lifted from real life - in this case, from the late Roman Empire, which ultimately collapsed and ushered in the so-called "Dark Ages."

In Foundation, mathematician Hari Seldon foretells the doom of the Galactic Empire. He has mastered a science called psychohistory, that allows him to analyze the behaviors of societies and accurately predict events; using these mathematical principles, Seldon has created a model of the entire Empire and peered into the future, foreseeing the collapse and the advent of a 30,000-year Dark Age. Although Seldon believes the Empire's downfall is inevitable, he believes specific actions can be taken to manipulate the future and prevent the Dark Ages lasting so long - reducing them to just a single millennium. Needless to say, the Emperor is none too pleased to hear Seldon's predictions, but after a terrorist attack on the galactic capital Trantor he chooses to exile Seldon to the remote planet Terminus on the galactic rim, where Seldon's new "Foundation" can continue their work without disrupting the galaxy.

Related: Every TV Show Coming In Fall 2021 (And Where To Watch Them)

But Foundation episode 2 ends with a shocking twist, as Hari Seldon's mission to Terminus is disrupted by tragedy. The events are entirely original to the TV series, not drawn from the books at all, so understandably even viewers who are well-acquainted with Asimov's books are unlikely to have seen this coming - what's going on?

Hari Seldon Has Been Murdered - By His Best Friend

Hari Seldon Death Foundation

David Goyer's Foundation is a character study as much as anything else, and Hari Seldon's protégé Gaal Dornick is the beating heart of the first two episodes. Gaal was drawn into this affair against her wishes, manipulated into joining the Foundation by being encouraged to arrive on Trantor at just the moment matters were building to a head, but she is an adventurer at heart and she has accepted her place in the Foundation. She's even begun to build a life for herself, becoming the lover of Raych, Hari Seldon's best friend. But Gaal's world falls apart once again at the end of Foundation episode 2, when she walks into Hari's room to find him lying dead on the floor, having been murdered by Raych.

Foundation episode 2 doesn't explain Raych's apparent betrayal, but it does hint the relationship between Raych and Seldon has been souring for some time, with Hari attempting to force Raych into doing something against his wishes. The most likely reason for the murder is that Seldon wanted Raych to kill him, because his presence among the Foundation was a variable he hadn't expected - he'd predicted his own death, but the Emperor had defied his calculations. It's likely Hari Seldon felt he needed to be a martyr in order for the plan to work, and so he pushed Raych to do the deed. Gaal's presence at the scene of the crime was just a matter of unfortunate timing.

Gaal Dornick Has Left The Foundation - But Where Is She Going?

Foundation Gaal Dornick 2

Raych - and likely Hari Seldon - had clearly planned the murder carefully, because they had prepared an escape pod. But Gaal's unwitting interruption changed everything, with Raych shoving Gaal in it because he feared she was now implicated in the crime. This likely means Raych has effectively committed suicide because of his love of Gaal, because he will no doubt be executed for murdering Hari Seldon. For her part, Gaal has been blasted out into space in cryogenic suspension. Nothing in Foundation is the result of chance, so it's likely she will be picked up by another ship - but where will she be taken, if not to the Foundation? Episode 2 doesn't offer any clues as to this point, but the books themselves may provide a hint. In Asimov's Foundation series, Hari Seldon had established a secret second Foundation on the other edge of the galaxy. It could be that he had intended Raych to go there, continuing to play his part in Seldon's plans - and that now Gaal Dornick will go there instead. That would certainly set the TV series in a very different direction, giving its writers a lot of creative opportunities.

Related: Every New Sci-Fi TV Show Releasing In 2021

The cryogenic suspension may be important given Foundation's nature, though, because a number of scenes have been set 75 years after the Foundation departed Trantor. Asimov's original stories span a millennium, and many of them are novellas rather than novels, with precious few recurring characters; the cryogenic suspension could be a smart plot device to allow Gaal to continue to be important to the ongoing narrative in the TV series, allowing her to reemerge decades later.

Hari Seldon's Psychohistory Is Flawed

Hari Seldon and Gaal Dornik stand side by side in Foundation

As shocking as the events of Foundation episode 2 may be, the most disturbing element is not Hari Seldon's death but Gaal Dornick's realization there is a flaw in his calculations. This was what drove Gaal to race to Seldon's room in the first place, and if she is right, the entire Foundation project is flawed. It's unclear whether Hari knew of these flaws or not; he may not have been honest, instead carefully restricting crucial information in order to ensure his plans came to fruition (which is what he did in the books). But if he isn't quite the master of psychohistory he believes himself to be, and if he has miscalculated, then Hari could have gambled the fate of the entire galaxy - and lost. The entire future of the galaxy is once again up in the air because of Gaal's realization.

The Galactic Empire Begins To Crumble

Brother Day stands with two fingers raised in Foundation

Meanwhile, back on Trantor, the Emperor's emotional reaction to the terrorist attacks may well have doomed his Empire. Blaming two feuding rim worlds for the destruction of the sky bridge, he has his armada exact brutal revenge, while he murders citizens and ambassadors from those planets. It's just the kind of despotic reaction guaranteed to incite rebellion, and it feels more than a little coincidental that it happened just when Hari Seldon needed something like this to make the Emperor feel insecure enough to actually consider his psychohistorical prophecies. It's possible the tragedy was in fact engineered by Hari Seldon, and everything that's happening is according to the mathematician's plans.

One of the worlds attacked by the Empire is Anacreon, a key planet in Asimov's books. There, Anacreon rebelled against the Empire, its secession one of the first events to mark what became known as the Fall. This caused massive problems for the Foundation on Terminus, disrupting essential trade routes that went through Anacreon space, and it ultimately forced them to support the enemies of the Empire - as Hari Seldon had intended. It's possible something similar will happen in David Goyer's Foundation series as well, with the uprising driven by the Emperor's overreach.

More: Every Sci-Fi Movie Still To Come In 2021