Nearby is a small but sustainable civilisation of humanoids who live between a river and a grounded but not irreparable spaceship called the Starliner. They came to the planet Alzarius from Terradon and much of the focus of society is on repairing their craft to make it navigable once more. It is an oligarchy ruled by three self-selecting senior colonists knows as Deciders, who ensure the smooth running and order of their adopted world and lay particular store on technical ability. One of the brightest of the younger generation of colonists is Adric, who bears a Badge of Mathematical Excellence in recognition of his computational skills.
However, his brother, Varsh, has rejected the regimented society of the Starliner and leads a band of rebels called Outlers, who steal harvested riverfruit and other foods to survive. However, all is not well in the colony. Strange eggs have started to appear in the riverfruit and this is interpreted by First Decider Draith using the precious System File of the Starliner as an omen of Mistfall, a strange periodic change to the planet during which the natural balance of society is threatened. Soon Mistfall begins, and the colonists move into the Starliner to protect themselves, apparently in a well prepared manner. Adric chooses the moment of confusion to try and steal some riverfruit to prove himself to his brother. Draith gives chase to his young protégé but falls and lands in the river – only to be dragged beneath the waves by a strange force. His last words are aimed at the chief scientists of the colony: “Tell Dexeter we've come full circle!" Adric muses on this as he heads into the forest in panic, finding the TARDIS. The Doctor and Romana take him in and tend to his leg wound, which recovers remarkably quickly. The Doctor heads off to investigate the planet, while Adric attracts Varsh and the other Outlers to the protection of the TARDIS.
The two other Deciders, Garif and Nefred, have meanwhile ordered the Starliner doors closed as per procedure, knowing that both Draith and Keara, an Outler and the daughter of a prominent citizen called Login, have not entered the ship safely. Despite his worries, Login soon accepts a position as Third Decider when it is determined that Draith has died. It is as well the doors have been closed – humanoid, aggressive Marshmen begin to appear from underwater, looking threatening (as shown in the picture above); and soon scuttling Marshspiders hatch from the eggs of the Riverfruit. The Marshmen beat on the walls of the Starliner to gain entry but the fearsome primitive creatures are not admitted. The Doctor, however, gains entry to the Starliner using his sonic screwdriver, followed by a young and inquisitive Marshchild. Both of them are soon found and taken before the Three Deciders. The Doctor is appalled when chief scientist Dexeter starts to perform vivisection experiments on the Marshchild.
A group of Marshmen have meanwhile carried the TARDIS to a settlement cave, intending to use it as a battering ram to force their way into the Starliner. Romana decides to venture outside. She is bitten by one of the Marshspiders and starts to change, seeming possessed. Adric panics and materialises the TARDIS inside the Starliner. When the Outlers emerge Login is reunited with his daughter, but the Doctor is not impressed not to be reunited with Romana. Thus he pilots the TARDIS back to the cave, and finds an alert but amnesiac Romana. The Doctor scoops up the remains of a Marshspider and then reverses his journey once more with Adric and an unconscious Romana in tow. By the time he is back in the Starliner, however, Dexeter has tried to examine the brain of the Marshchild, provoking it to attack and kill him and itself. The Doctor is so incensed he turns on the Deciders and denounces their society – revealing secret ship controls that show the Starliner has been ready to pilot from Alzarius for centuries but, for some reason, the farce of constant repair has been continued. The problem it seems is that though the Deciders understand the technical construction of the ship, no-one knows how to pilot it.
The Doctor persuades the Deciders to give him equipment to examine the cells of the marshspider and marshchild and also deduces that they are from identical DNA sources. This situation is complicated, however, when a transformed Romana releases the emergency exits and allows the Marshmen to invade the Starliner. The colonists retreat before the creatures, many of whom are more inquisitive than dangerous, but anarchy reigns. Nefred is mortally wounded while fleeing one room, but his last admission is that the colonists cannot return to Terradon, because they've never been there. It is realized that the present-day Alzarians are actually a subspecies of the Marshmen, who wiped out the Starliner's original Terradonian crew and then gradually evolved into human form to take their place.
The Doctor uses a protein serum to cure Romana, and they determine from research in the ship's science unit that the ship has been maintained for 40,000 generations by a species that has three aspects; spiders, marshmen, and the current humanoids. They are all from the same DNA and thus have come "full circle". This is the real secret of the System Files.
It is accidentally deduced that oxygen in pure form is problematic to the Marshmen, who have not the capability to cope with the gas in that concentration, and soon this non-lethal defence is used to force the Marshmen out of the Starliner. During their retreat Varsh is killed, leaving Adric in emotional turmoil. With the Marshmen returning to the swamps, the boy stows away on board the TARDIS. His fellow colonists meanwhile follow their dreams and pilot the craft away from Alzarius. The Doctor and Romana are unaware of Adric's presence as they pilot their own craft to another destination.