# The Ultimate Foe

The Ultimate Foe is the fourth and final serial of the larger narrative known as The Trial of a Time Lord which encompasses the whole of the 23rd season of the British science fiction television series Doctor Who. It was first broadcast in two weekly parts on BBC1 on 29 November and 6 December 1986. This segment is also cited in some reference works under its working title of Time Incorporated (or Time Inc.). The title The Ultimate Foe is never used on-screen and was first used in relation to these episodes for the 1988 novelisation, with the two episodes that comprise the serial being referred to as The Trial of a Time Lord Parts Thirteen and Fourteen. This was the last story to feature Colin Baker as the Sixth Doctor, as Baker declined to do the regeneration (when he was dismissed from the role) for the following story, Time and the Rani.
In the serial, continuing from the events of Terror of the Vervoids, the genocide charges against the alien time traveller the Sixth Doctor for destroying the Vervoids are interrupted by the Doctor's enemy the Master (Anthony Ainley), who seeks to have the Doctor and his prosecutor the Valeyard (Michael Jayston) destroy one another in the virtual micro-universe the Matrix, and to create a power vacuum where the High Council of the Time Lords is deposed so the Master can take command.

## Plot

The Sixth Doctor boldly claims the Valeyard's evidence has been falsified, and the Matrix has been tampered with. The Keeper of the Matrix insists this is impossible. Glitz and Mel arrive unexpectedly in the courtroom. The Master appears on the Matrix screen to claim responsibility and to demonstrate it's possible to breach the Matrix. At the Master's insistence, Glitz reveals the data he tried to obtain on Ravolox included technological secrets from the Matrix, which was stolen by the Sleepers. The Time Lords traced the Sleepers to their base on Earth and dragged the planet across space to the location in which the Doctor found it, nearly annihilating all life on the planet in the process. The Doctor denounces the Time Lords as decadent and corrupt. The Master explains that the Valeyard is a manifestation of the Doctor's darker side "somewhere between [the Doctor's] twelfth and final incarnation"; the High Council offered the Valeyard the Doctor's remaining regenerations in exchange for falsifying evidence.
When the Doctor demands to halt the trial as he cannot be both the defendant and prosecutor, the Valeyard flees into the Matrix, a virtual reality where normal logic does not apply. The Doctor pursues with Glitz, emerging next to a building labelled "The Fantasy Factory (proprietor: J. J. Chambers)". A clerk named Mr. Popplewick sends them to a deserted wasteland. To the Doctor's horror, hands emerge from the ground and grab him, dragging him underground. Glitz is unable to rescue him, but the Doctor rises from the ground unharmed, insisting correctly that nothing that happens in the Matrix is real. The Valeyard appears and taunts the Doctor before unleashing nerve gas, forcing the Doctor and Glitz to take refuge in a run-down cottage. As they stumble inside, it dematerialises – it is the Master's TARDIS.
The Master reveals that he wishes the Doctor to prevail over the Valeyard, since he fears the Valeyard's ability to defeat him. He puts the Doctor into a catatonic state and sends him out of his TARDIS to lure the Valeyard out of hiding. The Valeyard emerges onto a balcony, but fires upon the Master, forcing him to flee. Mel emerges from a tunnel and the Doctor, recognising her voice, emerges from his trance. She leads him out of the Matrix and into the trial room. They agree that she should tell the truth, and she confirms to the court that the scenes of the Vervoids' destruction, the basis of the Valeyard's charge of genocide, are as she witnessed them. The Inquisitor finds the Doctor guilty and declares that his life is forfeit. He accepts the verdict as the fulfilment of justice and is led off to execution.
However, this is another illusion. Mel is frantic that the Doctor needs help, grabbing the Keeper's key and entering the Matrix. She finds the Doctor and warns him – but he had already realised the courtroom was a fake and merely wished to reach a final confrontation with the Valeyard. Bribed by the Master, Glitz returns to the Fantasy Factory; he finds the master tape of the data he thought was destroyed on Ravolox. Glitz escapes with the data to the Master's TARDIS, while the Doctor asks Popplewick for Chambers; Popplewick doesn't comply. The Doctor and Mel lay hold of him, and the Doctor peels away his face to reveal Popplewick as a disguised Valeyard. They realise that a concealed machine in the room is a particle disseminator, with which the Valeyard plans to murder the members of the court.
The Inquisitor learns the High Council has been deposed. The Master appears on the Matrix screen to offer to impose order in return for power. He loads Glitz's master tape into his TARDIS systems, but a booby-trap is triggered, paralysing him and Glitz. Mel emerges from the Matrix to warn the Time Lords. They cannot turn off the Matrix screen, but the Doctor sabotages the Valeyard's weapon and the Fantasy Factory explodes; he flees the Matrix, back to the courtroom. The Inquisitor drops the charges against him and reveals that Peri survived the events on Thoros Beta and became Yrcanos's queen. She urges the Doctor to stand for Lord President of the new Council, but he suggests she should stand. He urges the Time Lords to be lenient towards Glitz, while he returns Mel back to her proper time.
As the Inquisitor leaves the trial room, she gives instructions to the Keeper of the Matrix. As he looks up at the camera, he is revealed to be the Valeyard.

## Production

| Episode | Title | Run time | Original air date | UK viewers (millions) |
| 1 | "Part Thirteen" | 24:42 | 29 November 1986 (1986-11-29) | 4.4 |
| 2 | "Part Fourteen" | 29:30 | 6 December 1986 (1986-12-06) | 5.6 |
Robert Holmes was originally commissioned to write the two episodes. However, he died from a chronic liver ailment after completing a draft of the first and left nothing beyond a plot outline of the second. The series script editor Eric Saward resigned around this time due to disagreements with the producer, John Nathan-Turner, but agreed to write the final episode based on Holmes' outline, and also rewrite Holmes' draft to tie the two together, for which he was credited as Script Editor. Much of Holmes's original draft, involving as it did a reenactment of one of the Whitechapel Murders ascribed to Jack the Ripper, was felt to be unsuitable, and most of the material set in the Matrix in the episode credited to Holmes is in fact Saward's work. The original ending to the segment as a whole (and, indeed, the whole Trial story and possibly the series) would have seen the Doctor and the Valeyard in an inconclusive cliffhanger, both (seemingly) plunging into a void to their deaths as an extra "hook". However, Nathan-Turner felt this was too downbeat and believed that it was important that the season did not end on an inconclusive note to demonstrate the series was back in business and avoid providing an excuse for BBC management to cancel the series altogether. Saward refused to change the ending and withdrew permission to use his script very late in the day, by which point the production team had been assembled and the segment was entering rehearsals.
John Nathan-Turner commissioned Pip and Jane Baker to write a replacement final episode. For copyright reasons they could not be told anything of the content of Saward's script (and there were lawyers observing all the commissioning meetings). The only similarity between the two is the announcement that the High Council of the Time Lords have resigned, which was a natural development of the earlier scripts. The new script ended on an optimistic note, with the Doctor departing for new adventures. In keeping with this more optimistic stance, Nathan-Turner decided to amend the script at the last minute to show how Peri had not died as shown in Mindwarp but had in fact survived and became Yrcanos's warrior queen. Her apparent death was a part of the Valeyard's tampering with the Matrix. A shot from the earlier story was used to show this. Nicola Bryant was absolutely disappointed to learn how the fate of her character had been changed. The working title of this story was Time Incorporated. This title did not appear in the final scripts or on-screen.
Although the other episodes of this season were the usual 25 minutes in length, it proved impossible to edit episode 14 down to that length. Nathan-Turner applied for and received special permission for the episode to run 5 minutes over its scheduled time slot, making it 30 minutes.

## Commercial releases
### In print

A novelisation of this serial, written by Pip and Jane Baker, was published by Target Books in April 1988 as The Ultimate Foe. The Ultimate Foe was the working title for the 9th to 12th parts of the season, now generally called Terror of the Vervoids. The novel ends with an additional scene in which Mel is returned to the Doctor's future, and hints that the events of the following serial Time and the Rani took place after several other adventures and before the Sixth Doctor's regeneration.

### Home media

In October 1993, this story was released on VHS as part of the three-cassette The Trial of a Time Lord set. On 29 September 2008, it was released on Region 2 DVD, similarly boxed with the other three stories of this season. This serial was scheduled to be released as part of the Doctor Who DVD Files in Issue 132 on 22 January 2014.
A limited edition Blu-Ray set of the series was released in October 2019 featuring optional extended versions of all 14 episodes as part of the extra features package.