The Third Doctor and Jo Grant visit the remote Stangmoor Prison to examine a new method of "curing" criminality, whereby the negative impulses are removed from the brain using the Keller Machine to enact the Keller Process. Professor Kettering, who is managing the delivery of the Process at the behest of the absent Emil Keller, reconditions a number of inmates including Barnham, a hardened criminal who is reverted to a more innocent and childlike state by the Process. The Doctor’s suspicions about the Keller Machine are heightened following a string of deaths, including that of Kettering himself, which seem to occur when the Machine is operated. Each death seems to be triggered by visions of personal phobias – and the Doctor is seemingly threatened by an inferno when he gets too close to it.
Meanwhile, Brigadier Lethbridge-Stewart and the troops of UNIT are handling the security arrangements for the first World Peace Conference. Captain Chin Lee of the Chinese delegation, whose delegation leader is dead, is behaving strangely in an attempt to heighten tension in relations with the United States. It emerges that her actions are done under the influence of the Master. She uses the transmitted power of the Keller Machine in her plans against the American delegate, Senator Alcott, who barely survives her attack. Captain Chin Lee is deconditioned by the Doctor, and tells him that Emil Keller is indeed the Master, whom the Doctor had previously trapped on Earth by stealing the dematerialisation circuit of his TARDIS.
Back at Stangmoor a riot has broken out and resulted in a dangerous criminal who was next in line for the Keller Process, Harry Mailer, seizing control of the prison. Jo is briefly taken hostage, but she enables the guards to retake the prison. The Master, who had heard of the Stangmoor riot by eavesdropping on UNIT, arrives and meets Mailer, to whom he supplies enough small bombs for Mailer and his prisoners to retake control of the prison. The Doctor returns to the prison to be captured by the Master, who sets the Keller Machine loose on the mind of his old foe, weakening the Doctor considerably. The Master is losing control of the Keller Machine, which contains a dangerous alien Mind Parasite, and forces the Doctor to help him contain its power. This done, the Doctor is imprisoned once more.
The Master has come to Stangmoor to engage the prisoners as a private army, and uses them to hijack a UNIT convoy transporting a deadly Thunderbolt missile nearby. The stolen missile is then pointed at the Peace Conference and Captain Mike Yates, who was detailed with leading the convoy, is taken prisoner by the criminals. Left in the dark, the Brigadier decides the Thunderbolt missile must be in Stangmoor and comes to the rescue in a "Trojan Horse" style assault. UNIT troops take control of the prison, killing Mailer and the other leading rioters. A freed Yates makes contact to tell UNIT that the Thunderbolt is being kept in an abandoned hangar nearby.
The Keller Machine is growing stronger and breaks free of the temporary restraints placed on it by the Doctor. The Doctor contacts the Master, who has gone to the hangar with the missile, and offers to return his dematerialisation circuit in exchange for the missile. The Master agrees to this proposition on the guarantee he alone will come. The Doctor has worked out that Barnham, having been subjected to the Keller Machine once and having no evil in his mind anymore, is immune to its growing power and uses the prisoner as a shield in transporting the Machine to the hangar for his showdown with his enemy. In the ensuing fight the Thunderbolt is triggered and the Machine destroyed, but the wider devastation from the missile is minimal. The Master uses the chaos to escape with the dematerialisation circuit, killing Barnham in the process. He contacts the Doctor by telephone to taunt him that he is now free while the Doctor remains trapped in his exile on Earth.
An insight into the Master's motivation and his relationship with the Doctor is given when the Mind Parasite turns on him and attacks him with images to evoke his deepest fear: the Master is confronted with and recoils from images of a gigantic Doctor towering over him and laughing maniacally down at him.
The Mind Parasite attacks the Doctor on three separate occasions. The first visions are tongues of flame, enveloping the Doctor's unusually terror-stricken face. He tells Jo as he recovers, "Not long ago I saw an entire world consumed by fire..." This is presumed to be a reference to the recent story Inferno. The images on the two latter incidents are of past monsters (including the War Machines, a Cyberman and a Zarbi). During these hallucinations, Dalek voices are heard chanting for subjugation, extermination, and destruction.
Some exteriors, primarily for Stangmoor Prison, were filmed in and around Dover Castle. This serial went so excessively over budget that its director, Timothy Combe, was not allowed to be considered for any subsequent Who work.
James F. McGrath of Patheos religion blog noted that the episode posed the question of pacifism: "can pure unadulterated kindness ultimately prevail? Or does it take evil, in whatever small a measure, to effectively combat evil?"
David J. Howe and Stephen James Walker, in their 1998 book Doctor Who: The Television Companion, noted that the Master's plan was "so convoluted that it seriously lacks credibility". However, they wrote that "the action is brought to the screen with such style and panache that the viewer hardly notices them", with the direction and the alien menace being the highlights. In 2009, Mark Braxton of Radio Times praised the direction and Delgado's Master, though he noted there was a high body count.SFX reviewer Ian Berriman gave the serial three out of five stars, finding it enjoyable if one did not concentrate on the Master's plan, noting that the "two aspects of the plan never dovetail satisfactorily".DVD Talk's John Sinnott rated The Mind of Evil three and a half out of five stars, writing that it kept a good pace and had "all of the elements that made Pertwee's run so enjoyable". Actress Katy Manning has stated that this is her favourite story from her three years on the show.
The original soundtrack for this serial was released on CD in the UK in February 2009. The linking narration was provided by Richard Franklin.
This story is unique amongst the Pertwee-era stories in that the BBC, for a long time, held no complete colour copies of any of its episodes. Approximately four and a half minutes of colour footage from Episode Six existed on an off-air domestic NTSC Betamax recording. As a full set of b/w 16mm film recordings exists, the story was released on VHS in this format, on 5 May 1998. The colour scenes, restored by combining the colour signal from the off-air recording and the geometry from the film recording, were included as a bonus extra after the story. Several colour clips from the story were included on the 2011 DVD release Day of the Daleks as part of the UNIT family history.
The serial was released on DVD on 3 June 2013. Episodes 2, 3, 4, 5 and 6 were restored to colour via the chroma dot colour recovery technique used for other black-and-white Pertwee-era stories. The telerecording of episode 1 does not contain chroma dot information (this was filtered out at the time it was made), and was recoloured using colour referenced from the other restored episodes. Keyframes, including the first frame of a shot and every fifth frame thereafter (Approximately 7,000 total) were hand coloured by Stuart Humphryes. Motion-estimation software was then used to interpolate the extrapolated colour from the key frames into the intervening frames.