Manussa is in the grip of a festival of celebration of the banishment of the Mara from the civilisation five hundred years earlier. In the absence of the Federator, who rules over a the three-planet Federation, his indolent son Lon is to have a major role in the celebration, supported by his mother the Lady Tanha and the archaeologist Ambril, who is an expert in the Sumaran period. Lon is intrigued with the notion that the Mara might one day return as prophesied, but Ambril is unconvinced and believes such talk is the product of cranks. When the Doctor tries to get Ambril to take the threat seriously he too is dismissed as a maverick, though the deputy curator Chela is more sympathetic to the Doctor and gives him a small blue crystal called a Little Mind's Eye, which is used by the Snakedancers, a mystical cult, in their ceremonies to repel the Mara. The Doctor realises the small crystal and its large counterpart, the Great Mind's Eye, can be used as focal points for mental energy and can turn thought into matter. This, he determines, is how the Mara will transfer from Tegan's mind to corporeal existence. He realises that the Manussans must once have been a very advanced people who could use molecular engineering in a zero-gravity environment. They created the Great Mind's Eye without realising its full potential, and the crystal drew the fear, hatred, and evil from their minds, amplified it and fed it back to them. Thus the Mara was born into Manussa and the reign of the Sumaran Empire began.
Meanwhile Tegan makes contact with Lon and passes the snake mark of the Mara to him too. They visit the cave from Tegan's dream which contains a wall pattern which could accommodate the Great Crystal. Lon is sent back to the Palace while she causes more havoc and takes control of a showman, Dugdale, who is used for her pleasure. Lon meanwhile covers his arm and goes about trying to persuade Ambril to use the real Great crystal in the ceremony, placing it in a position in a wall carving that will evidently enable the Mara to return as the Doctor predicted. To persuade him to comply, Ambril is shown a secret cave of Sumaran archaeological treasures and warned they will all be destroyed if he does not help him. Ambril thus agrees to the change in format.
The Doctor and Nyssa have meanwhile been aided by Chela, who shares with them the journal of Dojjen, a snakedancer who was Ambril's predecessor. All three venture to the Palace to persuade the authorities to do something about the situation, but soon see Lon is in the grip of the Mara and orchestrating a very dangerous situation. All three escape and the Doctor now uses the Little Mind's Eye to contact Dojjen, who lives in sandy dunes beyond the city. They venture there and the Doctor communes with Dojjen by opening his mind after being bitten by a poisonous snake. He is told by the wise old snakedancer that the Mara may only be defeated by finding a still point in the mind. All three now head back to the city to prevent the ceremony of defeating the Mara using the real Great Crystal. The festivities are now at a peak, with a procession taking place which culminates in a ceremony at the cave. Lon plays the role of his ancestor Federator in rejecting the Mara. After a series of verbal challenges he seizes the real Great Crystal and places it in the appropriate place on the wall. Tegan and Dugdale arrive and she displays the Mara mark on her arm, which is now becoming flesh having fed on the fear in Dugdale's mind. With the crystal in place, the Mara is able to create itself in the cave, becoming a vast and deadly snake. However, the Doctor arrives in time and refuses to look at the snake or recognise its evil, relying instead on the still place he finds through mental commune with Dojjen via the Little Mind's Eye. This resistance interrupts the manifestation of the Mara and its three slaves are freed while the snake itself dies and rots. The Doctor comforts a distraught Tegan, sure that the Mara has at last been destroyed.
In the redesigned TARDIS of the 1996 Doctor Who TV movie, one of the consoles displays different time eras such as the Rassilon Era, Humanian Era and the Sumaron Era. The Sumaron era may be a reference to this episode.