On a small island with a glass beach, surrounded by an acid sea, on the planet Marinus, stands a tower with many secret entrances. Within the tower is Arbitan, Keeper of the Conscience of Marinus, a vast computer developed two millennia earlier as a vast justice machine which kept law and order across the entire planet. For seven hundred years, the Conscience was absolute, radiating its power across the planet Marinus, and eliminating all thought of evil. But then Yartek, leader of the alien Voord, worked out how to resist its impulses.
When The Doctor and his companions Barbara Wright, Ian Chesterton and Susan Foreman arrive on the island, they are brought into the tower to an audience with Arbitan, who explains that the society of Marinus is in danger. Several submersibles containing Voord, humanoid creatures protected by amphibian-like black rubber wet suits, have washed up on the beach. Inspired by Yartek, the Voord are seeking to enter the tower and take control of the Conscience.
Arbitan explains that the Conscience has now been upgraded sufficiently to control the Voord again, but needs to be activated. Years earlier Arbitan had prevented the Conscience from falling into Voord control by separating the five Keys needed to regulate it. The five keys are in different locations - one is in Arbitan's possession, but the other four are scattered over Marinus. The keys can only be found by following directions pre-set into travel dials, watch-like devices with the power to transport the wearer across the planet to the correct locations. Arbitan asks that the Doctor and his friends help him fend off the Voord by gathering the keys together. Others have tried to accomplish this task - even Arbitan's own daughter - but none have returned to the tower.
The Doctor refuses Arbitan's request, but is unable to access the TARDIS due to a force field Arbitan places around the ship. And so the Doctor and his companions are coerced to aid Arbitan. As the four teleport away from the tower using the travel dials, Arbitan is attacked and stabbed to death by a Voord that has secretly gained access to the tower.
The first location visited by the travellers is the City of Morphoton. The seemingly advanced and pacifist inhabitants impress the travellers with the luxuries, advances and aesthetics of the city. But all is not as it seems. Barbara is the first to realize the truth when a hypnotic disc intended to make her mind receptive to the hypnotic pulses slips off her forehead, causing her to realise that Morphoton is actually a place of dirt and squalor rather than beauty and luxury. Unknown to the Doctor and crew, Morphoton is governed by four brain creatures with hideous eyes on stalks who, having outgrown their bodies, live in large bell jars and communicate through their life-support machines. The Brains of Morphoton use hypnosis to control the human population, and the entire City is subjugated to their will.
Once the Brains realize Barbara has seen the truth and is thus impervious to their hypnotic control, they order that she be killed. Barbara escapes and hides in the city, there making contact with the slave girl Sabetha, who has been blamed for Barbara's awakening and sentenced to death. Barbara deduces Sabetha is Arbitan’s missing daughter, and sees Sabetha wears one of the Keys about her neck. Barbara helps break Sabetha's conditioning, and together they escape and destroy the jars and equipment protecting the Brains. With their life-support ruined, the Brains die, and all the human subjects of the city are freed. Another slave called Altos remembers he too was sent to Morphoton by Arbitan, and he and Sabetha decide to join the Doctor and his friends on their quest. The six now split up, with the Doctor going ahead to find the final key in the City of Millennius, while the others attempt to find the second key in the next destination.
The next location for the five searchers is a dangerous screaming jungle, which has a particularly debilitating effect on the telepathic Susan. In the jungle is an ancient temple overgrown with plants. Much of the flora is hostile and the travellers are relieved to find the next Key so easily, propped on the top of a statue in the temple. However, this "Key" is a decoy and, when touched, activates ancient machinery that causes the statue to move. Indeed, the whole location - jungle and temple - is a place of danger and traps. When Barbara is caught in the statue mechanism and disappears into the temple, Sabetha argues she may have possibly used her travel dial to move on to the next location. Sabetha compares the "Key" Barbara found with her original and realizes the easily found Key is actually a fake. While Ian remains at the temple to search for the real Key, Altos, Sabetha and Susan go to the next location to search for Barbara.
Ian activates the statue mechanism and is also taken into the temple, where he finds Barbara again. Hiding in the temple is an aged and dying scientist, Darrius, whom Ian saves from an attack by a creeping vine. Very weak, the old man explains the traps of the temple are to fool the Voord, and that he too is a friend of Arbitan. Before dying, Darrius tells Ian and Barbara the Key is hidden in "D-E-3-O-2." The plants, mutated by a growth accelerator built by Darrius, become more and more aggressive. The two friends only just manage to retrieve the Key from an experiment jar before the vegetation overruns the temple.
Ian and Barbara now teleport to an icy wasteland where they meet the duplicitous trapper Vasor, who steals their Keys and sends Ian back into the wastelands where he hopes he will be eaten by packs of wolves. In the wastes Ian finds Altos, bound and abandoned, and works out Vasor is to blame. Ian and Altos return to the trapper’s hut and confront him, forcing the wicked man to reveal the stolen Keys in his possession and to take them to the ice caves where he had earlier abandoned Sabetha and Susan. The two girls have meanwhile searched the icy caves themselves and uncovered mechanized Ice Soldiers. The travellers are soon reunited and find the next Key frozen in a block of ice. Their act in removing it revives the Ice Soldiers, who begin a vicious rampage. They flee back to the trappers' cottage and retrieve their stolen dials, getting ready to escape. Vasor takes Susan hostage and demands that they stay. An Ice Soldier stabs him down from behind and they escape.
When the travellers reach the next location Ian finds himself accused of the murder of Eprin, a friend of Altos, who had discovered the key shortly before his death. The Key has now disappeared and Ian is accused of theft and Eprin’s murder. The punishment will be death if he found guilty before the court of Millennius. The other travellers are reunited in advance of Ian’s trial, at which the Doctor takes on the role of defense counsel. He succeeds in postponing the trial for two days while he gathers evidence and uses this time to work out what really happened to Eprin. He works out that the relief guard, Aydan, is implicated in the murder, but Aydan too is murdered during the course of the trial before he can reveal the truth of the plot. Things take a turn for the worse when Susan is kidnapped and used as a hostage to try and persuade the Doctor not to investigate the crimes any further. The kidnapper is Kala, Aydan’s widow, who is in league with Eyesen, the Court Prosecutor, who has succeeded in persuading the Three Judges of Millennium to find Ian guilty of Eprin’s murder. Luckily, the others find Susan before Kala can kill her, like she did to her own husband, and the plot is uncovered. Tarron, the Chief Investigator of the City, is now also persuaded of Kala’s guilt but they must still uncover her accomplice to prove Ian did not kill Eprin. The Doctor helps unmask Eyesen and uncover the last Key, which had been hidden in the murder weapon, and Ian is freed.
The travellers now return to Arbitan’s island using their travel dials. Altos and Sabetha have travelled ahead with all but the last Key in their possession. They do not know the old Keeper is dead and that Yartek is now in charge, clothed in Arbitan’s robes to maintain the ruse. Yartek has seized the first four Keys and holds Altos and Sabetha prisoner while he awaits the fifth and final one. When the Doctor and his three friends arrive they soon realize that the Voord has taken over control of the tower and the Conscience. The false Arbitan seems to be in control, but the Doctor is cleverer. He frees Sabetha and Altos and then unmasks the Voord. Ian too has played his part, and given Yartek the false key from the Screaming Jungle. When Yartek places the false Key in the Conscience, the machine explodes and he is killed along with the occupying Voord. The Doctor and his friends flee the tower with Altos and Sabetha before the growing blaze overtakes the ancient structure.