The Key to Time tracer points the Doctor and Romana to the cold and boring planet of Calufrax, but when they arrive they find an unusual civilisation that lives in perpetual prosperity. A strange band of people with mysterious powers known as the Mentiads are feared by the society, but the Doctor discovers that they are good people but with an unknown purpose. He instead fears the Captain, the planet's leader and benefactor. After meeting the Captain on the bridge he learns that they are actually on a hollowed-out planet named Zanak, which has been materialising around other planets to plunder their resources.
After repairing Zanak's engines, which were damaged when the planet materialised in the same place as the TARDIS, the Captain plans to take Zanak to Earth. The Doctor finds the true menace controlling the Captain is the ancient tyrant Queen Xanxia, disguised as the Captain's nurse, who uses the resources mined from planets in an attempt to gain immortality. Despite the Captain's apparent insanity, he is a calculating person who plans to destroy Xanxia. The Mentiads learn that their psychic powers are strengthened by the destruction of entire worlds beneath their feet.
Throughout Zanak, the Key to Time locator has been giving odd signals that seem to indicate that the segment is everywhere. Once the Doctor and Romana see the Captain's trophy room of planets, they conclude that Calufrax is the segment that they are looking for. They use the TARDIS to once again disrupt Zanak's materialisation around Earth while the Mentiads sabotage the engines. Xanxia kills the Captain when he finally turns against her. The Doctor, Romana, and the Mentiads destroy Zanak's bridge and Queen Xanxia, ending the devastation caused by Zanak's travels.