On Bowie Base on Mars, in the year 2059, base commander Adelaide Brooke is communicating with her daughter and baby granddaughter on Earth. They soon lose the signal.
The TARDIS materializes near the base and the Doctor steps out, wearing a space suit. He spots the base and walks toward it.
Yuri Kerenski leaves the station to set up a solar panel with a "No Trespassers" sign. The rest of the crew watch on the monitors until Adelaide tells them all to get back to work.
The Doctor is approaching the base when a robot, Gadget, captures him and orders him to the base. Inside, Adelaide orders him to identify himself, since they are unable to contact Mission Control for the next ten hours due to solar flares. The Doctor offers his word that he means them no harm and Adelaide reluctantly accepts his promise. Roman Groom explains that he controls Gadget via remote waldo arms. Meanwhile, Maggie and Andy call from the biodome to determine why the sensors show they have an extra person on board. They lose the signal and go about their work of raising vegetables. Andy takes a bite of a moist carrot, and then starts to convulse, while Maggie continues talking. When she turns back to Andy, she notices that he is kneeling, immobile. When she approaches Andy, he turns around to reveal he has undergone a hideous transformation, water dripping from his swollen and broken mouth. As Andy lunges at her, Maggie screams.
Adelaide and her crew try to figure out who he is, and explain that they are the first off-world colonists. When the Doctor realizes who they are and what year it is, he remembers who they all are... and that they all died in 2059. He confirms the exact date, November 21, and remembers that the colony is destroyed on that date. He apologizes to them and then informs them that he has no choice but to leave them. He informs them that it's been an honor, shakes their hands, and starts to leave. However, then he wonders where Maggie and Andrew are. Edward calls Maggie to see the Doctor before he goes, but all they hear over the intercom is an unearthly growling noise. The base crew mobilizes and discovers that the cameras are down. They check the exterior of the biodome and discover that someone is shutting down the lights. Adelaide goes over and orders the Doctor to accompany her, since the problems started when he arrived.
The Doctor, Adelaide, and Dr. Tarak go to the biodome, while Roman guides Gadget. As they walk, the Doctor asks Adelaide if it were all worth it, and the records show that she gave up everything to get to Mars. She explains that Earth almost reached extinction, and she sought to stand on a world untainted by humanity, and it was worth it. They get to the dome and find Maggie, lying unconscious on the ground. Tarak rolls her over while the Doctor looks around nervously. Edward, the second in command, and the nurse, Yuri, bring medical equipment and Tarak orders them to take Maggie back and keep her in isolation.
In the control room, the remaining crew, Tia and Steffi, confirm that Andy made the growling noise. The Doctor, Adelaide, and Tarak enter the dome and call out for Andy. The Doctor brings the lights up but there's no sign of Andy. Yuri calls to inform them that Maggie is okay. She says she has no memory of what happened and appears unharmed. She asks Yuri to release her, but he reminds her that she has to remain quarantined for 24 hours.
Tarak searches separately for Andy and spots him in the undergrowth. He is dripping wet, water oozing from his pours. Tarak approaches him and the mutated Andy turns, spraying water.
In the sickbay, Yuri watches video of his brother. He's unaware that behind him, Maggie is convulsing violently. She then looks up, her facial features distorted the same way as Andy, and asks where his brother lives. Yuri brings up maps of Earth, and Maggie says that she and her kind want the water of the world. Yuri turns and realizes that she's changed, and calls the others. He describes Maggie's appearance to Adelaide and the Doctor, and the base commander calls for Tarak. She and the Doctor run to search for him. Meanwhile, Edward orders Yuri to seal the quarantine center at maximum and goes to sickbay.
Adelaide and the Doctor find Andy holding Tarak by the head. Tarak collapse and then transforms, and the Doctor tries to get through to them. When they advance, the Doctor and Adelaide run for the exit. They get inside and seal the door just as Andy fires a blast of water from his hand. He then stares through the porthole at them and slams his face into the glass.
Edward arrives in sickbay and finds Maggie touching the glass and pouring water out of her body. Adelaide orders everyone to avoid touching any water in the base. Meanwhile, the Doctor tries to get through to Andy without success, and warns Adelaide that the human body is 60^ water, making them the perfect host. He insists that he has to go. However, before he can leave, Andy and Tarak start exuding water from their mouths. The Doctor warns that if the water is intelligent, it can get through the seals. The Doctor and Adelaide are forced to retreat. Meanwhile, the creatures manage to short out the controls, get through the door, and give chase. The Doctor and Adelaide find the Gadget robot, modifies it, and takes control from Roman. They get on and ride the robot at boosted speed, outrunning the water zombies. They get to the main dome's airlock and get inside, activating the power seals. Adelaide insists that they're safe but the Doctor warns that in the end, water always wins.
The Doctor and Adelaide go to the medical dome, where Maggie is staring out through the glass. The door seals aren't permanent, and Adelaide warns them to evacuate as soon as Maggie heads for the door. Adelaide tries to communicate it without success, but Maggie responds when the Doctor speaks to her in ancient Martian. They figure that some viral life form was trapped in the ice fields that they use for their water supplies. The Doctor realizes that the creature is creating water, and asks it what it wants. Yuri tells them that Maggie said she wanted Earth. Edward calls off Adelaide to the side and insists they take Action Procedure One. Adelaide reluctantly agrees and the Doctor confirms they're talking about evacuation. Adelaide gives the orders to the others, who confirm it will take three hours to load up the shuttle. Her commander gives her 15 minutes, and confirms that Andy and Tarak aren't moving. The Doctor warns that the creature, the Flood, is clever, and it deliberately chose the humans. She realizes that any of them could already be infected, and even one drop could contaminate millions. Adelaide returns the Doctor's suit and goes to investigate the ice field, and the Doctor considers leaving... and then goes after Adelaide.
Yuri apologizes to Maggie, and then shuts off the lights and seals the door. Once he's gone, Maggie applies water from her body against the door. Roman is sure she can't get through, but Edward isn't convinced. The camera goes out, and they're unable to watch as Maggie emerges and then gives off a high-pitched scream. Tarak and Andy hear her, turn, and walk back down the corridor.
The Doctor and Adelaide get to the ice field and look for any change in the process. As they work, she wonders why he's in such a hurry to leave. He insists that they're famous, but Adelaide figures out that he knows more. The Doctor explains that certain moments in time are fixed and that 50 years ago, Adelaide told her daughter something. He suggests that Adelaide's granddaughter may then hear that story. Adelaide talks of how she saw the Daleks and her father left her to find her mother. She never saw him or her mother again, Young Adelaide went to the window and saw a Dalek, which also saw her but left. It was then Adelaide knew that she would follow it out into the stars. The Doctor says that she started a journey that lead humanity out into the stars, and in 30 years her granddaughter Susie, inspired by Adelaide, will pilot the first lightspeed ship to Proxima Centauri. It all starts with Adelaide. She wonders who the Doctor is and why he's telling her this.
They discover that Andy logged on the previous day and reported a filter issue. Adelaide realizes that the water they've been drinking is safe and orders the evacuation to continue. She tells the Doctor to get back to his ship while she leaves with her people. They're unaware that Tarak and Andy have climbed to the top of the building within the dome. They finally realize the computer is alerting them that the two water creatures are above them. They exude water, which starts to seep down. Adelaide tells them to continue, while the Doctor remembers how Bowie Base is destroyed in a nuclear explosion. He then turns and leaves without a word. However, he discovers that Adelaide has sealed the airlock. She demands to know what happens to them, and threatens to kill him. The Doctor tells her that she can't kill him, and she couldn't shoot Andy. He then explains that by trying to change certain fixed events, it makes them happen. Her final action protocol is activating the nuclear device in the central dome, and that history says that Adelaide will activate that device, and no one will ever know why. Adelaide's actions inspire her granddaughter to take her people out into the galaxy, and her death creates the future. She asks the Doctor for help, but he insists that he can't change things or save anyone. The Dalek didn't kill her because it knew her death was fixed in time. When she wonders what will save him, the Doctor says that she will. She unlocks the door, releasing the Doctor.
Water seeps into the control center and cuts off their primary escape route. The Doctor listens as they take an alternate route but the ceiling collapses, trapping Steffi behind. She takes refuge in the office, sealing the door, but it's not watertight. She turns on the console and watches video of her children as the water covers her. She convulses and then turns, possessed, The creature emerges and Adelaide orders her people out as Steffi advances at them through the water.
Edward gets to the shuttle and prepares for departure.
As Roman follows the others, a single drop of water falls on his face. He starts to convulse and then transforms as the others look on, helpless to save him.
Maggie enters the shuttle and fires a blast of water up into the cabin. Edward seals the door, too late, and is infected. He warns Adelaide over the radio that the shuttle is compromised. Fighting the infection, he manages to activate the auto-destruct. The blast sends the Doctor flying away, while Adelaide, Yuri, and Mia are caught in the base as it violently depressurizes.
As the Doctor crawls away, he remembers that he is the last of the Time Lords... and returns to the base.
Once inside, the Doctor takes command and has them seal the hull breach. Adelaide tries to warn him away, but the Doctor informs her that he was told that four knocks would accompany his death. Andy pounds on the door three times, and the Doctor electrocutes him before he can knock a fourth time. As he prepares to use heat against the creatures, he explains that the Laws of Time were created by the Time Lords, and the Time Lords are gone. Now the Laws of Time are his to command. An explosion knocks him to the floor and they realize the environmental controls are destroyed. He needs to go outside, but discovers that his helmet was cracked in the explosion. He realizes that he's struggling against Time itself, and vows to win.
Maggie goes to the ice field and unleashes another scream, cracking the glacier open.
The Doctor tries to come up with a plan and realizes they need Gadget. He uses Roman's control system to send it out, holding the TARDIS key, while Adelaide prepares for Action Protocol Five. The Doctor realizes what she's doing and warns that he'll fight her as well if he has to. He then activates Gadget at high speed and sends it across the Martian surface directly for the TARDIS. Under the Doctor's control, it opens the door, goes inside, and activates the console. Meanwhile, the nuclear device counts down to twenty seconds. The Doctor steps forward as the TARDIS materializes inside the base.
The countdown reaches zero and the base explodes.
The TARDIS arrives on Earth on a snowy day in 2059, outside of Adelaide's house. Mia runs away in shock and Yuri goes after her. When Adelaide wonders how she can still be alive and inspire the future, the Doctor tells her that she'll have to inspire her granddaughter face-to-face. She warns that no one should have that much power, but the Doctor casually dismisses her concern and says that he's saved little people before, but now he's saved someone important. When Adelaide wonders who he is to decide, the Doctor tells her that he's the last of the Time Lords. She insists that it's wrong, and he's wrong, but the Doctor tells her that it's for him to decide. He tells her to go home and unlocks the door using his sonic screwdriver. When she wonders if there's nothing he can't do, he tells her there isn't anymore. As she goes into her home and the Doctor turns away, Adelaide draws her gun... and closes the door. He hears a gunshot and turns around, and realizes what she's done... and remembers the new history where Mia and Yuri survive, but Adelaide dies and Susie Fontana Brooke leads humanity into space.
The Doctor turns and finds Ood Sigma standing in the street. He asks the creature if it's his time to die because he's gone too far, but it fades away without providing an answer. Entering the TARDIS, the Doctor hears the Cloister Bell chiming and says no, and then departs.