A mysterious evil is at work on Gallifrey. The President of the Time Lords has been assassinated and the Doctor caught red-handed. An inexorable master plan has been set in motion. There can be no escape
On a nameless planet in the far future where invisible monsters prowl, the Doctor befriends a warrior woman named Leela, recently banished from her tribe, the Sevateem. She and everyone recognize the Doctor immediately. He is the Evil One who, in their mythology, holds their god Xoanon prisoner and must be destroyed.
Despite protestations against being the Evil One, mounting evidence points to the Doctor's prior involvement with Leela's people, and an error in judgment he once made in their distant past that puts them all in immediate jeopardy.
The Doctor and Leela encounter the placid and mind-powerful Tesh, the complete opposite of the savage Saveteem. They recognize the Doctor, too, but to them he is Lord; however, when it becomes evident the Doctor threatens their living god, Xoanon, the Doctor becomes a marked man.
As the Saveteem and Tesh finally close in for a fight to the death, the powerful but long-suffering Xoanon ignores their strife to commit its full resources toward killing the Doctor, even to the extent of destroying everyone.
The TARDIS materialize aboard a sandminer, a mining ship on a desert planet run by a robot labor force headed by a fairly small but sniping human crew. As one crewman is discovered strangled to death, the Doctor and Leela arrive just in time to become the prime suspects.
As the strangulations continue and the humans aren't sure who to blame, Leela meets up with an anomaly among the robot crew - an inquisitive, supposedly mute single-function labor robot capable of independent reasoning. Meanwhile the Doctor starts looking into the possibility that the murderer is a robot, and another crew member is targeted for death.
Hearing about a man who grew up only around robots and who has threatened to start a robot revolution, and who may be aboard the sandminer under an assumed name, the Doctor takes D.84 to seek out a possible secret workshop where he would be restructuring robot programming. Meanwhile, as one crew member suffers a complete mental breakdown, reprogrammed robots are ordered to kill all remaining humans.
With secrecy no longer necessary for the robot revolution, Controller Taren Capel shuts down all friendly robots and gives the remaining humans an ultimatum, or else their deaths will be slow and painful. With no conventional weaponry aboard their commercial vessel, the humans do what they can to resist while giving the Doctor time to work out a permanent solution.
The Doctor and Leela land in Victorian London, and find themselves in the middle of missing girls, mutilated bodies, and vicious Chinese gangs. The Palace theater, presenting hypnotist Li H'sen Chang seems to be at the center of it all.
After escaping from the vicious giant rat in the sewers, the Doctor & Leela team up with Litefoot. Chang, Mr Sin and Weng-Chiang go in search of the time cabinet, while the Doctor and Jago go in search of Chiang's lair.
Having rescued Leela from the jaws of the giant vicious rat, she & the Doctor dress up and attend Chang's show at the palace, but end up as part of the act. At home, Litefoot tries to protect the time cabinet.
Weng-Chiang has stolen the time cabinet from Litefoot's house, so the Doctor and Leela go to try and stop him from using it. They find an opium-drugged Chang. Jago teams up with Litefoot for their own investigation.