The TARDIS misses Metebelis Three and seems to materialise on a cargo ship in the Indian Ocean, but the Third Doctor and Jo soon realise that the ship’s occupants keep repeating their actions as if somehow controlled. The Doctor also sees that they are on the SS Bernice, on the very day that it suddenly disappeared without a trace.
The pair soon find a way out of the ship through a hatch made of an alloy alien to the Bernice that is ignored by the crew and passengers, but plainly visible to them both. Sonic screwdriver in hand, the Doctor opens the hatch and he and Jo venture into the circuitry of some sort of giant machine. They make their way to a marshy area that they think is the outside, but soon discover that they are still inside the machine and are chased by the Drashigs, huge swamp-dwelling carnivores, back into the circuitry.
It is here, where they stop to rest, that the Doctor realises that they have materialised inside the compression field of a Miniscope, a machine that keeps miniaturised groups of creatures in miniaturised versions of their natural environments. He says that he persuaded the Time Lords to ban these and deduces that they must have materialised in its compression field.
The Drashigs break through from the marsh and the Doctor and Jo are forced to return to the ship. They become separated in the confusion as the crew defend against the Drashigs, and the Doctor manages to find a way to the real outside.
While they remain inside the Miniscope, it arrives with its owners, travelling showman Vorg and his assistant Shirna, on Inter Minor. They are refused an entrance visa, as the entrance tribunal believes they are spies, and they are therefore allotted space on the next shuttle home.
Vorg finds the TARDIS inside the Miniscope, which is accidentally left out of the compression field for too long and thus returns to normal size. Meanwhile, two tribunal members plot to let the Drashigs escape from the machine and allow them to wreak havoc, forcing the President of the planet to resign.
The Doctor emerges from the Miniscope and is restored to his normal size. He tells Vorg that his machine is illegal, and attaches part of the TARDIS to it so that he can return to get Jo. After he goes back into the Scope, which is now overheating due to the Drashigs' damage, the device he attached is shot by a tribunal member and ceases to function, leaving the Doctor stranded. He finds Jo, but they collapse on the floor as the heat gets too much for them.
Two Drashigs escape, but Vorg manages to kill them by fixing the eradicator, sabotaged by the mutinous tribunal members. He then fixes the Doctor’s device, pushing the Phase Two switch which brings the Doctor and Jo back, just in time, and also returning all of the Scope’s other occupants to their rightful space-time positions.
As the penniless Vorg tries to get enough credit bars to return home by using the old three-magum-pods-and-a-yarrow-seed trick, the two travellers depart in the TARDIS.