In the TARDIS, the Doctor and Adric arrive based in N-Space in an area known as the Traken Union, an empire of peace and harmony. They are surprised to find a holographic image of the elderly Keeper of Traken appear in the TARDIS, calling on the Doctor's help. The Keeper explains that his title is about to pass on soon to Consul Tremas, giving him access to the powerful Source that is the centre of Traken's technology advancement, but senses evil within him, his wife Kassia, and their daughter Nyssa. The Keeper suspects a connection to Melkur, an evil creature that arrived years ago on Traken but became calcified in a grove in the capital. Melkur has since become something of a holy symbol, and Kassia was tasked by talking to it and keeping it clean; that task is soon to be passed on to Nyssa.
When the Doctor and Adric land at Traken's capital and visit the Keeper, their presence appears to cause the Keeper to warn the assembled group of a great evil, and though Tremas vouches for them, others, including the Fosters, guardians of the spiritual welfare of the capital, remain cautious about their presence. Soon, bodies in the grove are found, the Doctor and Adric determining they have been killed by some type of plasma weapon. Adric works with Nyssa to identify the energy signature of the plasma as being from a TARDIS, while the Doctor assists Tremas in diffusing the conflict over their presence. Unaware to either group, Kassia secretly visits Melkur, who gives her a headband to wear, providing the creature with mind-control over her while promising to keep her husband safe. Kassia is able to convince the Fosters to arrest Tremas, the Doctor, Adric and Nyssa, and uses the situation to convince the other Consul to install her as the next Keeper. When the Keeper dies, Kassia takes the throne, but at the pivotal moment of the ceremony is completed, she disappears, leaving the statue of Melkur in her place, now connected to the Source.
Having escaped their confinement, the Doctor and his allies seek to cause a servo-shutdown of the Source to destabilize it and disconnect Melkur from using it. As Adric and Nyssa prepare to activate it, the Doctor is drawn into the statue of Melkur, finding it to be a TARDIS. Inside, he meets his old enemy, a horribly disfigured Master. The Master reveals he is on his last regeneration, and seeks to use the Source to give him a new set of regenerations, and then attempts to subdue the Doctor. However, at the same time, Adric and Nyssa initiate the servo-shutdown, disconnecting the Source from the Master and causing his TARDIS to malfunction. The Doctor escapes the Master's TARDIS, and when Melkur disappears, another Consul, Luvic, takes the throne to restablize the Source before it completely dies.
After assuring all is well, the Doctor and Adric depart in his TARDIS. Later, Tremas discovers an alien longcase clock, and is transfixed to it when the Master emerges from it and merges his body with Tremas'. The newly reformed Master laughs as he re-enters the clock—his TARDIS—and dematerializes, leaving Nyssa wondering where her father has gone off to.