Timewyrm: Apocalypse

Timewyrm: Apocalypse was the 23rd episode of Season 28 of Doctor Who, it was also the third part of the Timewyrm arc

Plot
The Seventh Doctor is having flashbacks to his second incarnation. Certain that they mean something, he nevertheless can't figure it out. He allows the TARDIS to guide their flight, and it takes the Doctor and Ace to a planet called Kirith, billions of years in the future, near the end of the universe. The Kirithons are a visibly perfect race, excelling in physical grace and mental prowess—but they are handicapped by their dependence on another race, called the Panjistri, who for thousands of years have been their benefactors, providing everything they need. The Doctor and Ace meet an injured young Kirithon named Raphael, and help him back to the nearby town, where they are received as guests. However, the next morning, Raphael's injuries are gone without a trace.

The town is led by the Procurator Huldah, with his personal assistant, Revna, who is of Raphael's generation and secretly loves him. Within the town is the seminary, an institution of learning led by Miril, who is Raphael's mentor and surrogate parent. Miril tells the Doctor about the Panjistri and the planet's history; but he doesn't remember his own childhood, or his parents. Something doesn't add up; there was allegedly once a nuclear war, but there is no fallout, no radiation. The Doctor concludes, ultimately, that the Panjistri are deceiving the Kirithons, and tampering with their memories—but, why? What are they hiding? Meanwhile, the Panjistri's leader, the Grand Matriarch, is watching the Doctor's actions, with her servant Fetch—but even Fetch can see that something is wrong with the Matriarch, and her personality is changing.

Ace becomes close with Raphael, and persuades him to help her investigate. They check out the Harbours of the Chosen, the facility where the Panjistri make landfall when they come from their island fortress, Kandasi. They find it to be a lab where genetic and biological experiments are conducted; and they find the Homunculus, a horribly misshapen hybrid creature in an experimental fluid tank. They are caught by the Panjistri Reptu, the liaison between the Panjistri and the Kirithons, who says the Homunculus is the potential salvation of everyone. As they flee, Ace gives Raphael her backpack, which has canisters of Nitro-9 explosive; they split up. Raphael returns to the city and reports to Revna, only to find out that she is the one who told Reptu where to find them; he locates the Doctor and Miril, only to be betrayed again. All three of them are captured, and taken to the Harbours. Ace flees to a forbidden area called the Darkfell, where she meets a group of Kirithons called the Unlike, who have all been twisted through experimentation. They explain that the food the Kirithons eat, called  zavat, is the processed remains of their own dead, and is formulated to make them susceptible to memory manipulation. This is why they don't remember their true past, and why they have forgotten the many loved ones who were taken for experimentation. They also reveal that the Doctor has been captured; they agree to help her save him if he will in turn heal them and their home.

At the Harbours, Raphael attacks Reptu, showing the first aggression any Kirithon has ever shown toward the Panjistri. He fails, however, and the Doctor is taken to Kandasi and abandoned on a hillside. He makes his way toward what is ostensibly the Panjistri fortress, outwitting traps along the way, as the Grand Matriarch watches. En route, he has another vision of his second incarnation, in which he met a little girl named Lilith in an alien marketplace. Meanwhile, Raphael uses Ace's Nitro-9 to escape the Harbours; he and Miril meet up with Ace and the Unlike. The Unlike want to destroy the Homunculus before they pursue the Doctor; while they argue, it feeds on their anger, and breaks free, forcing Raphael to kill it to save Ace. They return to the seminary, and with the Unlike, they recruit the staff to form a resistance movement. They manage to shut down the power in the city, and the food supply; in addition to causing unrest against the Panjistri, the lack of Zavat will cause some people to regain their suppressed memories. Revna takes advantage of the situation to undermine Huldah; and when the Panjistri inevitably come to suppress the uprising and restore services, Huldah is executed, and Revna is made Procurator. The rebels are forced to flee into the Darkfell.

Ace and her friends take a Panjistri boat and set out for Kandasi; along the way, Miril is killed by a genetically-modified sea monster. On Kandasi, they reconnect with the Doctor, but find that the stronghold is empty; it contains only a transmat unit. The unit takes them to a huge space station near the planet, which the Kirithons have always believed to be a second moon—it is the true Kandasi. Here the Doctor reveals what he has learned: The Kirithons were created here, and never actually evolved. However, the station attempts to eject them as intruders; and though it is overridden by the Panjistri, Ace vanishes in the confusion. Reptu informs them that she has been taken to the Grand Matriarch. She will die, but in so doing, she will complete the Grand Matriarch's long plan to save the universe from its inevitable death. The Panjistri for millennia have accumulated the best and brightest of many sentient races, and combined their talents and experiences into a massive machine, the God Machine, which will have the power to manipulate reality—and the wisdom to pull it off. Only one thing remains to be added—aggression. The Homunculus was to have provided this, but without it, Ace will substitute, as she is from Earth, a world known to have been warlike.

The Doctor knows it will not work—all things, even the universe, have their time. But it's worse than that; for the Doctor himself has doomed it to failure. He explains that, after his last victory over the Timewyrm, it hid in the one place he would never have expected: His own past. It entered his mind immediately after his first regeneration, when he was weak; and on an alien world, it passed into the mind of a young, impressionable girl named Lilith, whose telepathic powers were overwhelming. Now, five thousand years later, Lilith is the Grand Matriarch of the Panjistri—and her victory will give the Timewyrm power over the God Machine and all creation.

Lilith has started to shut down the station, and it will soon fall apart; but in the meantime, she has blocked access to her chamber. The Doctor and Fetch, Lilith's now-abandoned servant, make their way across the hull to Lilith's chamber, and break in; meanwhile, Raphael hears a voice, of a long lost friend…he makes his way through hidden passages to the vast chamber where the God Machine waits. Unknown to anyone, he merges with the machine, giving up his own life willingly…

The Doctor confronts Lilith, who promptly kills Fetch. Fully in the thrall of the Timewyrm, she gloats over the Doctor as she prepares to add Ace to the God Machine…but it's too late. Raphael, having learned independence and aggression from Ace, has given the Machine what it needed, and now its power is absolute. It expels the Timewyrm from Lilith's body, and regresses her to innocence before she dies. It returns the Panjistri to Kirith, along with the Doctor and Ace; the Panjistri will be forced to live alongside their creations. Then the station explodes; even the God Machine acknowledges that its power is too much.

However, when the Doctor and Ace return to the TARDIS, they see that it is still reading the Timewyrm's existence. Ace remembers that Raphael was horrified at killing the Homunculus, and realises that the God Machine did not actually kill the Timewyrm, simply banished it. The hunt is not yet over.

Characters

 * Seventh Doctor
 * Ace
 * Timewyrm
 * The Grand Matriarch
 * Arun
 * Darien
 * Fetch
 * Huldah
 * Kraz
 * Miríl
 * Raphael
 * Reptu
 * Revna
 * Tanyel

The Doctor

 * The Second Doctor has in his pockets a pair of conkers, a yo-yo, a bag of glass marbles, an old banana skin and a needle and thread.
 * The Second Doctor sends his seventh self a warning about the Timewyrm.
 * The Doctor has met Pope Clement and Alexander the Great. He lent his ticket to the British Museum to Marx.
 * The Doctor has visited prehistoric Africa.
 * The Grand Matriarch states that the Doctor is "not only a Time Lord".

Energy and radiation

 * The planet Kirith has high levels of artron energy.

Technology

 * Raphael uses a delta wave augmenter.
 * The Panjistri are trying to build a God Machine to prevent the end of the universe.

Continuity

 * The Rills are mentioned. (Galaxy 4)
 * Ace mentions that she thought she saw an animal in the TARDIS. (Cat's Cradle: Time's Crucible)
 * The Second Doctor recalls Daleks (The Power of the Daleks), Cybermen (The Tenth Planet), and smugglers (The Smugglers) when remembering his travels with Ben and Polly.
 * The Doctor compares the retroactive surgery to the Alzarian healing factor. (Full Circle)
 * The Doctor saved two plays by Aristophanes from burning in the library of Alexandria, he sponsors Aristophanes and meets him in his current incarnation. (Mask of Tragedy)