Sir Reginald Styles, a British diplomat trying to organise a peace conference to avert World War III, is in his study at the government-owned Auderly House when a soldier dressed in grey camouflage and wielding a futuristic looking pistol bursts in and holds him at gunpoint. However, before the guerrilla can fire, he vanishes, leaving Styles to shakily tell his secretary he has been visited by a ghost. As the conference is of vital international importance, UNIT is called in. The Chinese have pulled out of the conference and Styles will be flying to Peking to try to persuade them to rejoin, and nothing must interfere with the conference's success. However, when the Third Doctor, Jo and the Brigadier go over to Auderly House, Styles denies ever seeing the "ghost", even though the Doctor notes the presence of muddy footprints in the study.
The guerrilla reappears on the grounds in a vortex-like effect, but he is intercepted by two huge humanoid aliens, Ogrons, who attack him and leave him for dead. UNIT soldiers discover the severely injured guerrilla and take him to the hospital while the Doctor examines his weapon and a small black box that was found in a nearby tunnel system. Styles leaves for Peking, while the Doctor discovers that the pistol, which is an ultrasonic disintegrator, is made of Earth materials, not alien, and that the box is a crude time machine, complete with a miniature dematerialisation circuit. As he tries to activate it, the vortex effect appears again and the guerrilla vanishes from the ambulance. The temporal feedback circuit on the time machine also overloads — as the Doctor explains to the Brigadier, it has blown a fuse. Since everything seems to be centred on Auderly House, the Doctor decides to spend the evening there.
The night passes without incident, but in the day, three guerrillas appear from the time vortex — Anat, a woman who is in command of the mission, along with two men, Boaz and Shura. They come across a UNIT patrol and disintegrate the two soldiers while making their way to the house. In the study, the Doctor tries to reactivate the time machine, causing an alert to be sounded in the 22nd Century. Shura enters the house, but the Doctor subdues him with some Venusian karate. Shura begs the Doctor to turn off the box, as in the future, a human Controller reports to the Daleks that the machine has been activated. The Daleks command that once the spacetime coordinates of the box are confirmed, whoever is using that device must be exterminated.
In the present, Anat and Boaz enter with Jo as their prisoner and demand that the machine be deactivated. The Doctor complies, and the conversation makes it apparent that the guerrillas believe that he is Styles, whom they are apparently here to assassinate. The Doctor shows them a newspaper to convince them otherwise, and Anat demands to know who the Doctor is. When Captain Mike Yates and Sergeant Benton enter the house to search for the missing patrol, the guerrillas usher the Doctor and Jo into the cellar where they tie them up. Finding the Doctor and Jo gone, Yates contacts the Brigadier, who tells them to search the grounds again.
In the future, the Daleks order the Controller to send troops to the frequency they detected earlier, and activate a time vortex magnetron, so that anyone travelling between the two time zones will be drawn to the Controller's headquarters. In the past, Anat sends Shura to contact the future for more orders, but Shura only manages to retrieve a bomb from near the tunnel before being attacked by Ogrons. He is wounded, but manages to stumble away.
In the cellar, Jo asks the Doctor why, if the guerrillas wanted to kill Styles, they do not just travel back to the previous day to try again, and the Doctor says that this is due to the "Blinovitch Limitation Effect". Before he can explain further, they are ushered back up to the study — the Brigadier is calling on the house phone. The Doctor is forced to pretend over the telephone that everything is fine at Auderly House. The Brigadier tells the Doctor that Styles has convinced the Chinese to rejoin the conference and that the delegates will arrive the next day. The Brigadier asks for reassurance that everything is all right, and the Doctor tells him it is, but the Brigadier gets suspicious when the Doctor asks him to also "tell it to the Marines." The Brigadier decides to go to the house and see for himself. Jo frees herself from her bonds and threatens to destroy the box the first guerrilla used, but Anat and Boaz tell her that it only worked for that person. Suddenly, the time vortex effect activates and Jo vanishes into the future, appearing in the Controller's headquarters due to the vortex magnetron.
There, the Controller ingratiates himself with Jo, who tells him everything, including the exact time and location where she came from. The Daleks use this information and send a Dalek supported by Ogrons to the present, where they attack the house. Anat and Boaz fire back, and flee towards the tunnels. The Brigadier arrives just in time to gun down an Ogron, and the Doctor commandeers his jeep in pursuit of the two guerrillas. In the tunnels he meets a Dalek, and runs away, finding Anat and Boaz just as they activate their time machines, and is swept up in the same vortex. In the 22nd Century version of the tunnels, the Doctor and the guerrillas are separated when Ogrons pursue them. The Doctor climbs out of the tunnels onto the surface, where he sees a Dalek order Ogrons to exterminate some rebels. When the Controller informs the Daleks that Jo mentioned a "Doctor", the Daleks react violently, declaring that the Doctor is an enemy of the Daleks and must be exterminated.
The Doctor stumbles into what appears to be a factory, and sees humans being used as slave labour, guarded by other humans. He is captured by an Ogron, and is being interrogated when the factory manager comes in and persuades the interrogator to let him speak to the Doctor. When they are alone, the manager asks the Doctor which guerrilla group he comes from, but the Doctor says he is not part of any group. Before any further conversation can take place, the Controller arrives, and takes the Doctor to see Jo. The manager contacts the guerrillas, who have made it back to their base with their leader, a man named Monia. The manager tells them of the Doctor, but he is discovered by an Ogron and killed. Monia decides that they must rescue the Doctor, because he seems to be the only man the Daleks are afraid of.
After an abortive escape attempt, the Doctor is strapped down to a Dalek mind analysis device, where images of the Second and First Doctors confirm to the Daleks that he is indeed their sworn enemy. The Controller bursts in, saying that using the mind analysis device will kill the Doctor. They should keep the Doctor alive for information on the rebels, and he will question the Doctor personally. The Daleks gloat to the Doctor that they have discovered time travel, invaded Earth again, and changed the course of history. The Doctor calls the Controller a traitor, and the Controller explains that at the end of the 20th Century, a hundred years of devastating worldwide wars began, killing 7/8ths of the population and forcing the rest to live in little more than holes in the ground. It was during this period that the Daleks invaded, conquering the world and using it for raw materials to fuel the expansion of their empire. Some humans cooperated — the Controller's family have been officials for three generations. The Doctor calls them a family of quislings.
The rebel guerrillas attack the Controller's base and rescue the Doctor. Monia is about to shoot the Controller but the Doctor tells him not to — the Daleks would have used somebody else in any case. The rebels take the Doctor back to their hideout and tell him the rest of the story. Styles organised the peace conference, and when Auderly House was blown up, everyone was killed. The rebels believe that Styles engineered the whole thing, and caused the century of war that followed. That was why they used Dalek-derived time travel technology to travel to the past, to kill Styles before he could destroy the peace conference. They used the tunnels because that is the only common location shared by the two time zones. The Doctor is sceptical, believing Styles to be stubborn but basically a good man. When the Doctor finds out that the rebels brought a bomb made of dalekanium with them, a powerful and unstable explosive that will affect even Dalek casings, he realises that the rebels are caught in a predestination paradox. They will cause the very explosion they went back in time to prevent, and create their own history. Indeed, back in the 20th Century, Shura has found his way into Auderly House and plants the bomb in the cellar.
The Doctor and Jo make their way back to the tunnels so they can travel back and stop Shura, only to run into an ambush the Controller has set up. The Doctor convinces the Controller that he has the means to stop the Daleks even before they have begun, and the Controller lets him go, only to be betrayed by the interrogator and exterminated by the Daleks. The Daleks send a strike force to the 20th Century to ensure their version of the future is preserved, and attack as the delegates arrive at the house. In the ensuing battle between the Daleks, Ogrons and UNIT, the Brigadier evacuates the delegates. The Doctor, back in the present, makes his way down to the cellar to try to convince Shura not to activate the bomb; Auderly House is empty, it will all have been for nothing. However, once Shura hears that the Daleks are entering the house, he tells the Doctor and Jo to leave — he will take care of the Daleks. The Brigadier tells his men to fall back to the main road as the Daleks search the house for delegates. Shura detonates the bomb, destroying the house and everything in it.
The Doctor tells Styles that it is now up to him to make the conference a success. Styles assures the Doctor it will be, because they know what will happen if they fail. The Doctor, nodding at Jo, says that they know too.