A UNIT soldier walks, as if in a trance, through the woods, his right arm twitching spasmodically. Nearby, the TARDIS materialises, and the Fourth Doctor and Sarah step out. The Doctor explains that the coordinates were set for Sarah's time but the linear coordinates were off, so they could be miles from London. In any case, Sarah is glad to be back on Earth. The Doctor detects an odd reading of energy or radiation nearby.
The Doctor and Sarah meet a group of four men in white suits and opaque helmets. When the Doctor asks them for directions, they start shooting at them with their index fingers. The Doctor and Sarah duck and run, with the four in pursuit. Sarah slips down a hillside and clings to a cliff ledge. The Doctor helps her up; at that point, they see the soldier, jerkily making his way towards the cliff's edge. The Doctor shouts at him to stop, but he pays no heed, running right over the cliff and falling to his death.
The Doctor searches the body, finding a wallet full of shiny, freshly minted coins, all dated the same year. They also spot a casket-shaped pod nearby, which the Doctor finds familiar. Before he can identify it further, shots ring out: the white-suited men have found them again. They run once more through the countryside, avoiding their pursuers and reaching a village, which Sarah recognises as Devesham, which lies about a mile from a Space Defence Station.
The village, however, is deathly quiet, and seems unpopulated. The Doctor decides to try the local pub, the Fleur-de-Lys, but it is also empty, and the Doctor finds the same freshly minted coins in the register. Sarah then spots the white suits coming down the street, accompanied by the "dead" soldier. A lorry arrives, carrying what seem to be villagers, all in a trance-like state. They are helped off the vehicle by the white suits, and distribute themselves around the village. Mr Morgan, the landlord of the pub, enters it along with several other people while Sarah and the Doctor hide in the store room. The villagers take their seats silently, waiting motionless until the clock strikes eight, when they suddenly come to life, acting normally.
The Doctor intends to get to the Space Defence Station and contact UNIT. He leaves, telling Sarah to meet him at the TARDIS if anything goes wrong. However, the "dead" soldier finds her in the store room and questions her. Morgan suggests that Sarah might be part of "the test". But when Sarah asks what test, he tells Sarah that she should go.
Outside, Sarah hides behind the lorry, observing one of the white suits turn around. Behind the opaque visor is nothing but a slab of plastic and electronics. Sarah runs for the woods, reaching the TARDIS. She spots a similar pod just next to the time machine and goes to examine it, leaving the TARDIS key in the lock. Suddenly, the TARDIS dematerialises without her, and as Sarah is still trying to understand why, a hand reaches out from the pod. Startled, Sarah sees a man lying inside, but when she goes closer, he grabs her around the throat. She breaks free and runs.
At the Defence Station, the Doctor asks a soldier on guard where the command officer is, but the soldier just stares ahead, unresponsive. Also inside the building, Senior Defence Astronaut Guy Crayford is addressed by a disembodied voice. The voice, named Styggron, tells him that there is a random "unit" within the complex and orders him to check.
The Doctor enters an office marked with Brigadier Lethbridge-Stewart's name, but it is empty. Crayford enters, and points a gun on him. The Doctor introduces himself as UNIT's scientific advisor. Crayford has heard of him, but as the Brigadier is in Geneva, and Colonel Faraday is in command, there is no one to confirm the Doctor's identity; he could be an impostor. Before Crayford can have the Doctor taken to detention, the Doctor flips the desk over and runs. However, despite making it outside, he is recaptured. Sarah sees this and sneaks into the building, going to the Doctor's cell and unlocks the door, unaware that from behind a wall a stony alien face is observing them.
Styggron contacts Crayford again, complaining about a second random unit. Crayford identifies this random units as the Doctor and Sarah. At that moment, the alarm sounds indicating the Doctor's escape. Crayford sends his UNIT soldiers to stop them. Hiding in a storage cupboard, the Doctor tells Sarah about Crayford. She replies that it is impossible: Crayford was in deep space while testing the XK-5 Space Raider when it vanished, presumed destroyed. The Doctor and Sarah venture out to find Sergeant Benton standing in the reception area, who points a pistol at them. Styggron wants the Doctor captured alive. When Crawford cancels the kill order, Benton becomes dizzy, giving the Doctor and Sarah a chance to run away. Crayford orders Harry Sullivan to cordon off the perimeter road.
The two decide to return to the village and warn London, while being pursued by tracker dogs. Sarah twists her ankle while running through the woods and this slows her down. The Doctor hides Sarah in a tree, taking her scarf to draw the dogs away. He then hides in a stream, the dogs losing his trail. Unfortunately, when the soldiers turn back, they spot Sarah, and capture her. Styggron tells Crayford to locate, but not seize the Doctor. He has other plans for him.
Meanwhile, in an alien-looking room, Sarah is strapped down to a table. Harry tells her it is no use to struggle, and under Styggron's order, commences the scan. In the village, the Doctor finds the telephones are not working. He meets Morgan, who tells him the lines are down after a gale. Styggron speaks to another of his kind, Chedaki, who feels that the time for experiments are over, but Styggron insists that they must confirm their techniques are flawless if they are to conquer worlds other than Earth. Styggron contacts Crayford and tells him to commence the final test.
In the pub, the Doctor finds more oddities: an unused dart board, plastic horse brass on the wall and a tear-off calendar with only one date on every page - Friday 6 July. The telephone rings, and the call is for the Doctor. It is Sarah, who tells the Doctor she was captured but managed to escape. She asks the Doctor to meet her by the Village shop and to be careful of the robots. He hangs up the call, then finds that the telephone has stopped working again. The Doctor meets Sarah, who explains how she escaped. The Doctor remarks on the providence of her finding the only telephone in the village that worked, and believes they are being tested to find out how smart they are.
He decides to take Sarah to the TARDIS and use the radio there. However, the TARDIS is gone. The Doctor is puzzled: the ship is not programmed to auto-operate, unless... he asks Sarah for her TARDIS key, and when she claims she has lost it, the Doctor tells her she never had it. When Sarah put the key in the lock, she released the TARDIS's pause control and it continued its journey to Earth. This is not Earth, this is not a real forest, and she is not the real Sarah. Moreovet, the real Sarah wouldn't wearing the scarf, which the Doctor took off to draw the dogs away. The Doctor grabs the duplicate by the shoulders and demands to know where Sarah is. The duplicate pulls free, but falls to the ground, her face popping open and revealing the electronics underneath.
The android Sarah rises to its feet and starts to fire its pistol at the Doctor's retreating form. Chedaki tells Styggron that it was a foolish experiment. The Doctor could undo their plans. Styggron dismisses this; both the village and the Doctor will be destroyed by a matter dissolving bomb. The real Sarah is being kept alive so Styggron can test the virus he intends to use to cleanse the Earth of human life. All the while, Sarah is feigning unconsciousness and listening. When the coast is clear, she gets up and sneaks away.
The Doctor watches the lorry drive into the village and evacuate the androids to the Kraal base. The Doctor is grabbed from behind by Styggron, who gets two white suits to tie him up while the Kraal places the bomb at the Doctor's feet. Luckily, Sarah too has made it back to the village, and uses the Doctor's sonic screwdriver to cut his bonds. With seconds to spare, they run into the base and shut the door, as the village dissolves into a wasteland.
However, the two are surrounded by androids, who escort them to a cell. The Doctor tells Sarah that he should have realised — the radiation levels he picked up when they landed were those of Oseidon, the Kraal planet. The levels are increasing and the planet will soon be uninhabitable, which is why the Kraals are invading Earth. The duplicated village and their androids were a training ground.
Crayford enters the cell and tells the Doctor that it is all for the best. Soon, the Kraals will send his ship back by space-time warp so he can make a normal landing. He has recently established radio contact with Earth, and fed them a story of how his ship was trapped in an orbit around Jupiter and he survived by rationing his supplies and recycling his water. The world's attention focused on his landing, the space shells containing the androids will be taken for meteorites, who will emerge and pave the way for the main invasion fleet. He is helping the Kraals because while Earth left him for dead, they rescued his ship and reconstructed his body. The Kraals only want to survive, and have also promised him no humans will be harmed as long as they obey.
Styggron gets "Harry" to place a drop of the virus in a jug of water to be taken to the cell. Meanwhile, although the sonic screwdriver is useless on the door, the Doctor has managed to remove a floor plate, intending to use the wiring below to electrocute their android guard. "Harry" enters with the water, and also to take the Doctor away. Before he goes, he tells Sarah not to waste the water and mentioned it is very good electrolyte.
The Doctor is strapped down to the Kraal analysis table which will copy all his knowledge and experience. Despite what Styggron has told Crayford, he reveals that does intend genocide. Earth's resources are too limited to be wasted on an "inferior species". The virus, distributed by androids, will wipe the Earth clean in three weeks, then burn itself out. Styggron will then signal the invasion fleet. Styggron leaves the machine to do its work, and when it finishes, the stimulation will make the Doctor's head explode.
Sarah rigs the wiring beneath the cell floor, then sets a small fire to lure the android guard in. He steps in the puddle of water, and is electrocuted when Sarah applies the power cable. She makes her way to the Doctor and turns off the scan. She helps the disorientated Time Lord out of the base, heading for Crayford's rocket before it takes off. The rocket is launched, and the G-forces start to crush them.
Sarah blacks out, but is awakened by the Doctor. He tells her that was nothing; there is a more dangerous ride ahead. Before the rocket lands, the pods will be ejected, and the Doctor and Sarah will ride two of them to Earth to warn the real Defence Station, although he cannot guarantee they will survive the trip down. As they talk, neither notices a nearby pod open slightly to reveal an android Doctor. On Earth, Matthews at the Defence Station's scanner room picks up Crayford's rocket. Grierson, the man in charge, informs Colonel Faraday. Meanwhile, having found the TARDIS in the woods near Devesham, Benton and Harry have been searching for the Doctor and Sarah, but to no avail. Benton is worried, as he has never known the Doctor to leave the TARDIS key in its lock.
Faraday welcomes Crayford home on the radio, but the signal is broken up by the "meteor shower" of pods which, unusually, slow down as they enter the atmosphere. Some of the pods land in a nearby field, and one opens up to reveal the Doctor. However, he is unable to find Sarah. Sarah, having landed elsewhere, finds the TARDIS in the woods. As she looks around, the Doctor taps her on the shoulder. However, this Doctor is an android, and behind it a pod opens to disgorge another Sarah replica. The real Sarah runs for it. The XK-5 re-establishes contact and comes in for a landing. Harry and Faraday head for the rocket, not knowing that Styggron is there with Crayford.
The real Doctor enters the Station, and recognises the "dead" soldier. Showing him a pass, the Doctor tells the soldier that if he sees the Doctor again today he is to report it to him immediately. The Doctor goes to the scanner room, leaving the soldier puzzled. When Benton tells him where Harry and Faraday are, the Doctor contacts them on the radio and urges them not to enter the rocket. He will meet them at the lift.
While the Doctor gives Grierson some instructions for modifying the radar dish, an android Matthews has incapacitated Benton and introduced an android replacement. Grierson says that if the Doctor points the dishes down here, it will jam every piece of electronic equipment for miles. Faraday returns to the scanner room, demanding an explanation. The Doctor tells them about the Kraal invasion. However, the Doctor is too late: Harry and Faraday have been replaced, and the android Doctor is pointing a gun at him. He slams the door in the android's face and leaps through a window. Outside, he meets Sarah. The Doctor tells Sarah their only chance is to stop the androids before they take over the complex, and runs back towards the scanner room, bluffing his way past "Benton" by posing as his duplicate. Sarah climbs up the rocket towards the real Harry and Styggron.
Grierson finishes his modifications, but is shot in the shoulder by the android Doctor before he can turn on the power. The android is about to shoot the original when Crayford enters, saying that Styggron promised no killing. The "Doctor" calls him a fool, and tells him about the virus. Crayford cannot believe this, but the real Doctor tells him that his rocket was actually hijacked by the Kraal, and they did not reconstruct but merely brainwashed him. Realising the truth, Crayford rushes out, distracting the android long enough for the Doctor to make his move. In the struggle, the Doctor manages to activate the power to the radar, jamming all the androids in mid-step.
In the rocket, Sarah unties Harry and Faraday. Styggron enters, holding a ray gun on them, but Crayford appears and attacks him. The two grapple, and Styggron shoots Crayford. The Doctor makes his own entrance, punching the Kraal, who falls on the vial of virus, cracking it open. Styggron shoots the Doctor before he dies. Sarah is horrified, but the real Doctor shows up — he had programmed his duplicate to distract Styggron. As proof, the android disintegrates into its component parts.
Sarah and the Doctor make their way back to the TARDIS. Sarah says she is going to take a taxi home, but when the Doctor offers to take her home instead, she smiles, "How can I refuse?" The two enter the ship and it vanishes.