The TARDIS materialises in a corridor, and the Doctor steps out bewildered and alone. He walks into a room, where it is revealed that he is being put on trial for conduct unbecoming a Time Lord. The Inquisitor notes that the Doctor has been on trial previously, and the Valeyard states that he will argue that the Doctor was shown too much leniency on that occasion. The Valeyard opens the case by using the Matrix to show the Doctor's involvement on the planet Ravolox.
The Doctor and Peri arrive on Ravolox, which is virtually identical to Earth. He tells Peri that the official records state that the planet was devastated by a fireball, but they note that the forest they are walking through suggests otherwise. They are seen by Sabalom Glitz and Dibber, who attempt to shoot the Doctor; but he moves off just in time. Glitz and Dibber discuss their plan to destroy the "L3 robot" by sabotaging its light conversion system, which has been turned into a totem by a primitive tribe on the planet.
The Doctor and Peri find an apparently abandoned building and explore it. Peri discovers a sign saying "Marble Arch" — a London Underground sign, which means that they are on Earth. Peri begins to mourn for her planet.
The Doctor asks what the relevance of this is, then asks why Peri is not with him on the station. The Valeyard answers that she is where the Doctor left her, and states that the Doctor's evident temporary amnesia - a side-effect of being taken out of time - should soon pass.
The Doctor goes into the complex alone because Peri is upset, but she is captured by two masked figures. Meanwhile, Glitz and Dibber are brought before Katryca, Queen of the tribe. Glitz claims that the totem attracted the fireball that devastated Ravolox, and asks for it to be taken down. The Queen tells him that others have asked for the totem to be dismantled, and none have succeeded. Glitz and Dibber draw out their guns, but they are overpowered and locked up.
The Doctor finds an underground complex, but is caught. He is accused of spying, and sentenced to be stoned. The Doctor tries to block the rocks with his umbrella, but is knocked unconscious.
The Valeyard proposes that the inquiry into the Doctor's activities should become a full blown trial, with the penalty being the termination of his life.
Other officials arrive and break up the stoning. The Doctor is still breathing, but before he can be killed, Merdeen receives a message from the Immortal stating that he wishes to question the Doctor. The Immortal, revealed to be a huge humanoid robot, commands its two assistants to release the service robot.
Peri is brought before Katryca, who informs Peri that as there are few women, she will need to take many husbands. She is then put in the same prison as Glitz and Dibber. They tell Peri their plan to destroy the Robot. They are taken back to Katryca, who tells them that Glitz will be sacrificed because of his attempt to destroy the great totem.
The Doctor is taken to the Immortal, who introduces itself as Drathro. He commands that the Doctor work with the two assistants. The Doctor identifies the problem, and tries to leave in order to fix it, but Drathro does not allow him to leave, as his instructions were to maintain an underground system. The Doctor electrifies the robot and his assistants, and escapes. Drathro sends the service robot to track down the Doctor. Meanwhile, Peri, Glitz and Dibber overpower the guards and escape. Dibber remains behind to plant a bomb on the Black Light converter, whilst they go to the underground complex.
In Marb Station, Merdeen tells Balazar that there has been no fire for hundreds of years, and that he should leave the complex. They encounter the Doctor, and Merdeen implores him to help Balazar escape. Peri, Glitz and Dibber, pursued by tribesmen, find the Doctor, and they flee into the Marb Station, but are trapped between the tribe and the service robot. The tribesmen shoot at the service robot and disable it. The Doctor tries to re-enter the underground complex, but the tribesmen insist they all return to the village. There, The Doctor is brought before Katryca, but she is unimpressed with his explanation of the true nature of the Totem, and puts them all back in the prison cell. Glitz confirms that the planet is actually Earth.
Drathro reactivates the service robot, and send it to the village. It breaks into the building with the Doctor, stuns him and takes him away. The tribesmen disable the service robot, and decide to attack the Immortal's castle to steal his technology. Peri rescues the Doctor from the service robot, and they set off to the underground complex to stop Katryca and disable the black light system. Katryca and tribesmen arrive at the Castle, where they are confronted by Drathro,. He electrocutes Katryca, and dismisses the rest of the tribe.
The Doctor enters Drathro's domain, promising to help repair the black light system. However, he determines it to be beyond repair, and tells Drathro that he must shut down the Black Light System to prevent a massive explosion. Drathro refuses to allow that as it would mean its own destruction. The Doctor pleads with him, saying that the explosion could destroy the entire universe, but that only makes Drathro determined to allow what he thinks is a unique event.
Balazar and Peri plead with Merdeen to help them, noting that he would die if the converter exploded. Glitz and Dibber arrive and follow them into the Castle through a food chute. Drathro attempts to kill by turning on the food processing system, but Dibber shoots him through the wall. Glitz tells Drathro that they have black light on their ship, and offers to take the robot to the Andromeda Galaxy. Drathro agrees, and leaves with Glitz and Dibber.
The Doctor realises that the black light system has already begun to self-destruct, and that all he can do is prevent it starting a chain reaction. The system explodes, but the blast only destroys the Castle, and as a result Drathro collapses. The Doctor and Peri leave Merdeen and Balazar to take the remaining inhabitants to a new life on the surface.
The Doctor announces to the court that he has saved the Universe, and starts to present his defence. The Valeyard warns the Doctor that he has more evidence to come, and that the Court will demand the Doctor's life at the end.
Doctor Colin Baker (Sixth Doctor)
Companion Nicola Bryant (Peri Brown)
Lynda Bellingham — The Inquisitor
Michael Jayston — The Valeyard
Tony Selby — Sabalom Glitz
Joan Sims — Queen Katryca
Glen Murphy — Dibber
Tom Chadbon — Merdeen
Roger Brierley — Drathro
David Rodigan — Broken Tooth
Adam Blackwood — Balazar
Timothy Walker — Grell
Billy McColl — Humker
Sion Tudor Owen — Tandrell
Writer Robert Holmes
Director Nicholas Mallett
Script editor Eric Saward
Producer John Nathan-Turner
Executive producer(s) None
Production code 7A
Series Season 23
Length 4 episodes, 25 minutes each
Originally broadcast September 6–September 27, 1986