The Doctor and Jo Grant land in the middle of a prison break, only to find that the Master has hypnotised many people. After their trances are broken, the Brigadier informs the Doctor that they all work for the Freedom Corporation, which had been set up thirty years ago. The Doctor decides to investigate the Freedom Corporation. He attends a demonstration given by Gerald Gooder to show off his time machine. The Doctor is relieved to find that Gooder doesn't know what he's doing, but is still suspicious. Late at night Jo and he sneak in to the building. They find Gooder destroying their prototype time machine. They follow Gooder to find the Master, who traps the Doctor in the construct.
The Doctor and Jo are trapped, with no way out.
Meanwhile, the Brigadier attempts to negotiate with the Master in order to rescue the Doctor and Jo. The Brigadier allows the Master access to his time machine, but the Master instead turns on a device that sends out time waves, causing everything on Earth to regress backwards in time. The Master is immune to the effects.
The Doctor has given up hope of getting out of the construct. To his and Jo's surprise and delight, the TARDIS appears, and the Doctor's memory of time travel is fully restored. He realises the Time Lords restored his memory and his TARDIS to him so that he can rescue Earth from the Master's device. The Doctor, seeing his freedom at hand, is sorely tempted to escape from the Time Lords and lose them in the Time Vortex. Jo's pleading, as well as the realisation that the Time Lords will find him anyway, convince the Doctor to come to Earth's aid. He convinces the Master to reverse the device. The Master is recaptured.
Due to time waves coming out of the time machine, the Doctor has visions of previous and future incarnations of himself trying to warn him, including a short, dark man with checked trousers and a tall hat, and a young, fair-haired man wearing a cricket outfit.