The Tesh approach Leela and she draws her knife, waiting for their final assault. But as she leaps out at them, the lights flicker and the corridor turns red. The Tesh hesitate and then run. Leela grabs one and asks what is happening. He explains that it is "Failsafe" -- the end of the world.
She enters the computer room to find Xoanon screaming "Who am I?" while the Doctor writhes on the ground. Leela fires her disruptor at the images of the Doctor's face and they fade. She drags the Doctor out.
The Doctor wakes up the hallway. He tells Leela that Xoanon is the most powerful computer built but is insane. He first instinct will be to kill the Doctor because the Doctor contradicts what Xoanon thinks is real. He looks around and wonders what's going on -- there's a strange smell in the air. Leela reaches for the wall and the Doctor shoves her back, then throws something at it to get a shower of sparks. Xoanon has electrified the walls.
The Tesh that Leela knocked out earlier wakes as the Doctor wonders why Xoanon didn't electrify the floor. The Tesh attacks, hitting Leela in the solar plexus to put her out of commission. He tries to push the Doctor into the wall, but the Time Lord breaks his grip. They struggle and roll over, the Tesh trying to push the Doctor's hand into the wall. Leela can only watch, gasping for air. Finally, the Doctor breaks free and Tesh flies into the wall and is killed.
The Doctor laments the loss and then leads Leela away.
Calib and Thomas gaze over the plane to the Mordee rocket. They have at last reached he Place of Land. Neeva recites the litany, but Thomas thinks they have outgrown the old beliefs. Neeva asks why they have stopped believing when they have proof but Thomas replies that they don't have to believe when they have proof. Calib tells Thomas to gather the men to attack. Neeva repeats that they must destroy the Tesh -- then adds that they must destroy Xoanon -- since Xoanon has betrayed them.
The Doctor has returned to the auxiliary control room. He notes that, "the very powerful and the very stupid have one thing in common. They don't alter their views to fit the facts. They alter the facts to fit the views. Which can be uncomfortable if you happen to be one of the facts that needs altering." As he talks, he sees Leela in a mirror moving around behind him and raising her gun. He ducks as she fires and takes cover behind a wall. Leela pursues in a trance. He takes out a metallic cube and uses the sonic screwdriver to make it vibrate. He tells her the gun is getting heavy. She drops it and then wakes up. She is confused about what happened but the Doctor tells her she's just tired. He decides to go to the main computer control room.
Gentek reports to Jabal in a panic -- the savages are attacking. Jabal chides him for behaving like an animal. Gentek begs forgiveness and then calmly reports the situation. Jabal tells him to fall back and he will set up a heavy disruptor to eradicate the savages.
Leela and the Doctor are slinking through the corridors when Xoanon electrifies the walls again. Leela is appalled that Xoanon knows where the are but the Doctor points out that they know where Xoanon is. She wouldn't want an unfair advantage, would she? She says she would, which doesn't surprise the Doctor.
The Tesh retreat before the Sevateem which makes Thomas worry that it's too easy. Calib wants to push ahead with the assault but the younger man worries they are walking into a trap. Calib pushes ahead anyway. Neeva muses that it won't be finished until Xoanon is destroyed.
The Doctor is now in the computer room looking over the monitors when an alarm rings. Leela notices and asks the Doctor about it. He realizes that Xoanon has set the atomic generators to overload. They will explode in 24.5 minutes unless he can strip his mindprint from the computer.
Gentek sets up a massive disruptor cannon in the corridor. Jabal tells him that they will create projections of walls to force the savages into tis corridor and then destroy them all. But he loses his train of thought as he feels something touch his mind. Gentek feels it too. They slowly begin to walk away in obedience to Xoanon.
The Doctor continues his work on he computer, watched by Leela. The Doctor's image appears on the wall. Leela begins to respond to his thoughts. The image starts chanting, "Destroy and be free."
Calib peers around the corridor and see the disruptor. They jump out but no Tesh are there. They wonder why no one is manning the trap but then start hearing Xoanon's mental call. They touch their heads and start chanting, "Destroy and be free."
Neeva arrives and picks up the disruptor cannon in his arms. He tells Xoanon he can hear him but ignores him, moving on into the corridor.
Leela pulls her knife and raises it over her head. She stabs at the Doctor just as he moves and is stunned as it plunges into the computer, sending a shock into her body. The Doctor helps to a chair and then resumes work. But just as he is ready, the Tesh and Sevateem arrive. The grab him and hold their knives at his throat.
But Neeva is running through the corridors, calling out to Xoanon. He reaches the computer core and fires the disruptor at an image of the Doctor's face. An electric bolt arces out and kills him. But the shock stuns the Doctor's assailants. He breaks free, puts a metal circlet on his head and hits a button. Xoanon screams and the Doctor writhes in pain. His face disappears from the computer room as everyone grabs their heads in confusion. The computer gradually resets itself.
Much later, Leela sits by the unconscious Doctor, eating some packaged food. She waves a piece under his nose and he wakes up. She tells him he's been out for two days. She asks what happened -- she can't remember anything. The Doctor explains that he removed -- he hopes he removed -- half of Xoanon's personality. Leela tells him Xoanon has been quiet. Jabal's people won't go near the computer room and won't listen to Leela's explanations. The two tribes are in a guarded truce. The Doctor decides to see Xoanon. Leela asks if she can come and the Doctor assents.
They find the abandoned disruptor cannon in the hall. The Doctor realizes why Xoanon lost his hold on everyone. Leela reports that Neeva can't be found and the Doctor explains that Neeva had gone psychotic and couldn't be controlled.
The computer door opens and a calm clear voice calls the Doctor in. The computer room is now bathed in beige light. The Doctor asks Xoanon how he feels and the computer replies that he feels whole.
Leela asks why he did the things he did and Xoanon explains that he created a world in his own image. He made the people act out his torment. He told himself he was creating a super-race. Breeding independence, strength, boldness and courage in one tribe; self-denial, control and telepathy in the other. He used hostility to speed up the process so that he could eventually breed the best of both tribes. He agrees with Leela that it was a horrible thing but at least it's over now -- thanks to the Doctor.
The Doctor demurs that he started the whole thing and Xoanon replies that his was a mistake anyone could have made. The Doctor indignantly replies that not anyone could have done it and Xoanon laughs heartily. He asks the Doctor to sit and a couch appears. As the two people sit, Xoanon asks where he began to go wrong.
Jabal, Gentek, Thomas and Calib are arguing over who should lead their tribes. The Doctor arrives and jokes that this is democracy at work. He tells them that Xoanon is very sorry and is willing to put his great power at their disposal. He presents them with a device that will destroy Xoanon if they wish. He asks if any will use it and they all back off. The device vanishes.
Gentek says they still need a leader. Calib nominates himself but Jabal says they will not be lead by a savage. Leela replies that she is a savage but has spoken with Xoanon. Thomas says this makes her the obvious choice. Leela responds that she's far too irrational and asks the Doctor for support. But he has vanished. She runs after him.
The Doctor strolls through the jungle, whistling Mozart. Leela catches up to him and asks if he needs protection from the creatures. The Doctor explains that they were projections of Xoanon -- they're gone now. He tells her goodbye but Leela wants to come with him. She points out that he likes her and the Doctor replies that he likes lots of people but he can't cart them all around the universe. Not to be deterred, she jumps into the open TARDIS. The Doctor tells her to come out and then cries out not to push that button.
With a grinding roar, the TARDIS takes off.