While wandering the Martian landscape in his spacesuit, the Doctor is detained by the inhabitants of the human colony Bowie Base One, under the command of Captain Adelaide Brooke. During his interrogation, he learns that the date is 21 November 2059. According to future history, on this day the base was destroyed in an explosion and Brooke and her crew were all killed. This event is fixed in time, and the Doctor, unwilling to interfere, decides that he must leave Mars.
However, a crisis is developing: two colonists, Andy Stone and Maggie Cain, have been infected by a strange life form which causes their bodies to gush copious amounts of water. The virus soon spreads, with Andy passing on the condition to Tarak Ital. After Maggie is safely secured in the medical wing, the organism present in her body reveals its desire to reach Earth, a planet rich in water. The crew decide that it is too dangerous to remain, and plan to evacuate in an escape shuttle. Before departing himself, the Doctor informs Adelaide that she must die today, on Mars, if history is to unfold as it should, but also tells her that her death will inspire her descendants to travel further into space and establish peaceful relations with extraterrestrial species. As the Doctor is making his way back to the TARDIS, Maggie breaks out of isolation and infects Ed Gold, the shuttle pilot and Adelaide's second-in-command. Before the condition takes a hold over him, Ed manages to trigger the shuttle's self-destruct mechanism, which traps the infection on Mars but also leaves the surviving crew with no means of escape. Witnessing the explosion, the Doctor is overcome with defiance against time itself and turns back to save the others.
Andy and Tarak mount Bowie Base's outer shell and exude water, which cascades into the control centre and infects Roman Groom and Steffi Ehrlich. Since it seems inevitable that history will follow its set course, Adelaide activates the base's self-destruct sequence. However, the Doctor uses a remote-controlled robot, GADGET, to access the TARDIS, operate its controls and transport the ship into the control centre, rescuing Adelaide, Yuri Kerenski and Mia Bennett before the base is destroyed.
The TARDIS materialises outside Adelaide's house on Earth. Yuri and Mia are shocked by their experiences and depart. Alone with Adelaide, the Doctor explains his reasoning for interfering in set events: as the last of the Time Lords, he is no longer bound by the laws of his race and has total authority over time. Proudly declaring himself the "Time Lord Victorious", he vows that with this power, he can now ensure the survival of pivotal figures such as Adelaide as well as "little people" such as Yuri and Mia. Scolding the Doctor for his new-found arrogance and asserting that "the Time Lord Victorious is wrong", Adelaide returns home and commits suicide. The Doctor's efforts at changing the timeline are mostly undone, although Adelaide dies on Earth rather than Mars, Yuri and Mia live through the events of the episode and the exact circumstances surrounding Bowie Base's destruction are now known to Earth.
The Doctor is overcome with emotion, realising that his hubris will have consequences. Ood Sigma appears in the street. Visibly shaken, the Doctor asks him whether he has finally gone too far — whether the time has come for him to die. Unresponsive, Sigma vanishes, and the Doctor staggers back into the TARDIS to the ominous sound of the Cloister Bell. With a defiant "No!" he begins to operate the controls.