The Fourth Doctor shows Sarah some of the other parts of the TARDIS interior, and they come across the older, secondary console room which, unlike the primary room is decorated with wood-panelling and has a more archaic feel. Activating the viewscreen, the Doctor sees a swirl of living energy in the time vortex — the Mandragora Helix — which starts to draw them in. The intelligence within the Helix starts to psychically attack them as the Doctor tries to pilot the TARDIS through it. The ship ends up inside the Helix itself, and the Doctor and Sarah duck behind the TARDIS as a fragment of glowing Helix energy flies by. They escape in the TARDIS, not knowing that the fragment has entered with them.
In 15th century San Martino in Italy, a peasant revolt is violently put down by Count Federico and his men led by Captain Rossini. In a palace, Federico's brother the Duke of San Martino lies dying, attended to by his son Giuliano and Giuliano's companion Marco. The Duke's death had been foretold by Hieronymous, the court astrologer, but Giuliano, a man of science, does not believe in such superstition. In fact, Hieronymous is working for Federico, and the horoscope's prediction of the Duke's death was helped along by poison. Hieronymous tells the Count that he feels his powers are growing, but all Federico wants is for the astrologer to foretell Giuliano's death next, and he will take care of the rest.
The TARDIS materialises in a field near San Martino, and when the Doctor and Sarah go out to explore, the energy fragment flies out of the TARDIS, unseen. Sarah wanders off and is kidnapped by a group of men in hooded robes. The Doctor tries to rescue her but is knocked out, and when he awakes he witnesses the energy fragment fly towards and kill a peasant. Searching for Sarah, the Doctor is confronted by the Count's men and arrested.
At the court, the Doctor tries to tell Federico that the energy fragment could spell the end of the world. The Count at first thinks the Doctor is a seer, like Hieronymous, but when the astrologer quizzes the Doctor, it becomes clear that the Doctor does not believe in any of it. Federico orders the Doctor to be executed as a spy. Meanwhile, Sarah is brought before a priest and told that she is the foretold sacrifice to Demnos, the Roman god of moonlight and solstice. She is dressed in a white robe and told that she will be sacrificed when the moon rises over the southern obelisk. Back at the palace courtyard, the Doctor is led to the excutioner, forced to his knees for decapitation.
Before the executioner's sword lands, the Doctor unfurls his scarf and hooks it around the executioner's ankle, throwing him off balance. The Doctor escapes out of the palace grounds and finds his way into some catacombs beneath the city. The guards, fearing the Brethren of Demnos who reside in those passages, stop their pursuit. Inside, Sarah is laid out on an altar. A purple-robed figure wearing a golden mask is about to stab her with a silver dagger when the Doctor snatches Sarah away, just as the fragment appears in the chamber, suffusing it with a red glow and providing a distraction for the two to escape.
Giuliano examines the body of a guard that was killed earlier by the passage of the fragment, and while he does not know the cause of the guard's death, he dismisses ideas that it was some kind of fire demon. The Doctor and Sarah are found by some palace guards. In the temple, the Helix manifests itself as a pillar of red light and tells the purple-robed figure that he alone will be given undreamed-of powers to carry out its will on Earth and become the planet's supreme ruler. After the Helix vanishes, the figure removes the golden mask, revealing the face of Hieronymous.
The guards bring the Doctor and Sarah, not to Federico, but to Giuliano, who shows him the dead guard's body and tells the Doctor of fears that if Federico rules San Martino, all knowledge and learning will be suppressed. Elsewhere, Federico discovers that Giuliano has invited several nobles to San Martino to celebrate his succession to the Dukedom. Angered, Federico demands Hieronymous make up a new horoscope and poison Giuliano before the next evening.
The Doctor deduces that the Helix chose San Martino because the Brethren provided a ready-made power base. The 15th century was the transition between the Dark Ages and the dawn of the Renaissance — the Helix could gain control of the Earth now through a new religion. The Doctor tells Giuliano the temple must be destroyed. They go to the temple, and the Doctor enters the catacombs alone, but as he enters the main chamber the Helix attacks him psychically. Rossini informs Federico of Giuliano's trip to the temple, and the Count decides to take his guards to the temple to kill his "pagan" nephew. The guards corner Giuliano with their swords. Sarah runs into the catacombs calling for the Doctor, but is caught by the Brethren.
The Helix attack stops, but the Doctor is prevented from venturing further into the temple. He leaves to find Giuliano fighting off the guards and joins in with a sword of his own. Giulianio is wounded, and suddenly, the Brethren emerge from the forest armed with staves and force the guards to retreat. The Doctor and Giuliano go into the catacombs. The priest is eager to sacrifice Sarah, but Hieronymous decides to use her as bait for the Doctor. Hieronymous allowed the Brethren to save Giuliano because the young prince may still have value. Sarah is brought back to the astrologer's chambers, and is drugged and hypnotised to believe the Doctor is an evil sorcerer. Hieronymous gives her a poisoned needle to kill the Doctor.
At the palace, the invited nobles begin to arrive, and Federico realizes he does not have much time to eliminate Giuliano, but Rossini is unable to find Giuliano in San Martino. Hieronymous warns Federico that his life is in danger. Federico scoffs, believing Hieronymous to be a fraud, but is suspicious enough to tell Rossini to banish Hieronymous from the city.
In the catacombs, Giuliano and the Doctor find Sarah, who cannot remember anything after her capture by the cult. They make their way into the palace dungeons through a secret passage. The Doctor goes to confront Hieronymous, whom he has deduced is the leader of the Brethren, in his rooms. Sarah secretly follows, trying to carry out her post-hypnotic orders. When the Doctor speaks to Hieronymous, Sarah sneaks up behind with the needle, but the Doctor manages to snap her out of the trance, just as the guards come for Hieronymous. The astrologer escapes, but the guards capture the Doctor and Sarah as well as Giuliano.
In the dungeons, Federico accuses the prisoners of being followers of Demnos. Rossini rushes in, informing the Count that members of the Brethren are gathering on the streets and moving towards the temple. The Doctor tries to convince Federico that Hieronymous is the real threat. Federico wants to see for himself, and takes the Doctor with him and some guards, leaving the others as hostages. In the temple, Hieronymous summons the Helix, which begins infusing him and his followers with power. Disguised in hoods, the Doctor, Federico and the guards enter and witness the ceremony. Federico steps forward, calls Hieronymous a traitor, and rips off the golden mask, only to reveal glowing energy in the place of a face. Hieronymous raises a finger, and electrical energy stabs out at the Count, reducing him to ashes.
Hieronymous then fires at and kills the two guards as well, but fortunately does not seem to have seen the Doctor. The Doctor joins the circle around the Helix as Hieronymous announces that Mandragora will swallow the Moon the next evening and then the Brethren will strike. The Doctor slips away unnoticed. Back in the palace dungeons, Rossini is about to kill the prisoners when the Doctor arrives and reveals that Federico is dead. With that, the guards change their allegiance to Giuliano, and take Rossini into custody. The Doctor observes that the Brethren are still a danger. He tells Giuliano to fortify the palace in preparation for their attack.
In the meantime, the Brethren are driving people out of the city, killing those who refuse with bolts of fire, isolating the palace. Giuliano wants to cancel the masque that will celebrate his accession, but Marco is confident they can defend the palace against the Brethren, and that to cancel the masque would be a sign of weakness. The Doctor does some astronomical observations and calculates there will be a lunar eclipse that evening — Mandragora swallowing the Moon — and when the Helix takes over, it will remove all sense of purpose from mankind. Right now, however, the Helix energy is spread thinly over all the Brethren, and it could be exhausted. He asks Giuliano for a breastplate and a length of wire. Wearing the breastplate under his coat, if he has guessed right about the nature of Helix energy, he could drain it off.
Hieronymous knows of a secret way into the palace, and he intends to infiltrate his men under cover of the masque. The Doctor makes his way into the temple, and grounds the altar with wire. Hieronymous addresses the Doctor as "Time Lord", and says that Earth has to be possessed; if mankind's ambition is not checked, it will eventually spread into the Galaxy and the powers of Mandragora will not allow a rival within their domain. Hieronymous fires a bolt of energy into the Doctor's chest, knocking him back painfully, but the Doctor survives. More bolts fire into the Doctor, but he continues to egg Hieronymous on.
At the masque, the Brethren make their appearance, and the masqueraders run about in panic as they fire into the crowd, killing two. Hieronymous then appears and tells the Brethren to take the others down into the temple for the final sacrifice. The Moon goes into eclipse, and the Brethren place their hands on the altar as a ball of Helix energy descends. However, it consumes the Brethren instead, expanding and then fading away. "Hieronymous" removes his mask — it was the Doctor, imitating the cult leader's voice. The Doctor explains it as a case of "energy squared", putting the Mandragora Helix back where it came from.
The Doctor and Sarah make their goodbyes to Giuliano. Just before they leave in the TARDIS, Doctor tells Sarah that while Giuliano will not have any more trouble with Mandragora, humanity will. The constellation will be in position again in 500 years, at about the end of the 20th century…
Doctor Tom Baker (Fourth Doctor)
Companion Elisabeth Sladen (Sarah Jane Smith)
Jon Laurimore — Count Federico
Gareth Armstrong — Giuliano
Tim Pigott-Smith — Marco
Norman Jones — Hieronymous
Robert James — High Priest
Brian Ellis — Brother
Antony Carrick — Rossini
Pat Gorman — Soldier
Jay Neill, Peter Walshe — Pikemen
James Appleby, John Clamp — Guards
Peter Tuddenham — Voice
Peggy Dixon, Jack Edwards, Alistair Fullarton, Michael Reid, Kathy Wolff — Dancers
Stuart Fell — Entertainer
Writer Louis Marks
Director Rodney Bennett
Script editor Robert Holmes
Producer Philip Hinchcliffe
Executive producer(s) None
Production code 4M
Series Season 14
Length 4 episodes, 25 minutes each
Originally broadcast 4 September–25 September 1976