As poisonous gas floods the Earth, Sylvia smashes the window, saving her father. At the factory, Colonel Mace's forces are struggling with the vehicles emitting the poisonous gas. Mace is unaware that the Sontaran clone of Martha is accessing the NATO defense systems and downloading them onto a chip. The Doctor heads back to UNIT after convincing Donna to come with her over Sylvia's objections.
Martha sends the defense plans to the Sontaran ship in orbit where General Staal receives the information and Luke is thrilled they're finally at war. The Doctor arrives at the factory and the Martha clone quickly passes on the Doctor's earlier warning to maintain her cover. The Doctor gives Donna a key to the TARDIS and sends her inside, then informs Mace he plans to board the Sontaran ship in his TARDIS, taking Martha along with him. The Martha-clone passes this on to the subverted UNIT troops, who attach a teleport unit to the TARDIS and signal Staal to transmit it up. Luke teleports back to the Rattigan Academy to mobilize his own troops, and Staal boasts that the humans have no idea what his true plans are.
The Doctor and the Martha-clone discover the TARDIS is gone. The Doctor notes that "Martha" doesn't seem concerned about her family and fiancé. Meanwhile, the Rattigan students look on in dawning horror at the poison gas, but Luke tells them not to worry about it.
UNIT has determined the gas isn't toxic until it reaches 80% density, and has pinpointed the orbital signal that triggered the ATMOS systems. The Doctor contacts the Sontarans and accuses them of cowardice, but Staal refuses to reveal his plans. He reveals that he has captured the Doctor but the Doctor sends a hidden message to Donna, who is watching, to call him by phone. Staal removes the TARDIS from his control room to a nearby storage chamber.
Luke makes his plans to rebuild a new world on a distant planet, but when the other students try to leave, he draws a gun on them but they ignore him and leave.
As the gas density rises, Donna calls Sylvia and Wilfred from the TARDIS and assures them that the Doctor will look after her. They wonder how the Doctor can deal with the worldwide disaster but Donna assures them he can.
The Doctor analyzes the gas and realizes the Sontarans need it for some other purpose. With the gas at 60% density, Mace prepares to launch nuclear missiles against the Doctor's insistence. However, Staal is unconcerned and orders Commander Skorr to prepare to land with his soldiers. The countdown goes to zero… and nothing happens. The Doctor wonders why the Sontarans bothered to stop the launch when the missiles wouldn't harm the ship. Meanwhile, Staal orders his men into the factory to "protect the operative." Mace orders his men to open fire but they're powerless against the Sontarans and readily gunned down. Mace is forced to order a retreat but many of his men are killed. The Doctor wonders why the Sontarans are interested in the factory, and UNIT detects a transmission signal.
Luke returns to the Sontaran ship to report his failure, but Staal is unconcerned and informs Luke he would have killed the students as soon as they arrived. He orders Luke's execution but Luke quickly teleports away, and Staal shuts down all teleport links.
The Doctor realizes there's something in the factory the Sontarans need. While Mace tries to figure a way to get around their copper-lined bullet suppression systems, the Doctor calls Donna and directs her to the teleportation system so she can reopen the link. He instructs her how to disable the Sontaran guard by hitting its probic vent, and then goes with Mace who has his men switch to non-copper bullets. Donna is forced to hide as a squad of Sontarans go by.
Mace calls in the air carrier Valiant and uses its engines to clear away the fog, then open fire on the factory. UNIT opens fire from the ground and enter the factory, while the Doctor goes off on his own with the Martha-clone following. He finds the cloning facility and the real Martha, captive. The clone draws a gun on him and the Doctor notes he's known she was an impostor all along and wanted her to stop the launch to avoid a nuclear war. He then rips the mental circuitry from the real Martha's head, causing the clone to collapse.
Donna has found the teleport link and calls for help, and the Doctor gives her the instructions to reactivate the link. Meanwhile, Mace finds Commander Skorr and guns him down, granting him a noble death.
The Doctor works with the teleport equipment while Martha tries to get her clone to help by drawing on their shared memories. The clone explains that the gas is also a clone feed: the Sontarans are changing Earth into a clone farm capable of creating billions of new soldiers. The clone admits she is envious of all the plans that Martha has and then dies, as Martha removes her engagement ring from the clone.
Donna reactivates the teleportation system but two Sontaran soldiers arrive. The Doctor teleports her away just in time, then teleports the TARDIS back to the factory. He then teleports all three of them to the Rattigan Academy where Luke begs them not to tell anyone. They ignore Luke and go to the Academy laboratories.
Staal orders his men to increase the signal to the ATMOS system then launch clone parts. Wilfred tries to reassure Sylvia as they start to choke. The Doctor works to build an atmospheric converter and runs outside to the yard to activate it. he fires a charge up into the atmosphere, igniting it and destroying the gas. Earth's inhabitants look on as the fire sweeps across the sky, and then emerge to breathe the clean air. However, the Doctor says that they're in trouble and Staal orders a full-out attack.
The Doctor uses Luke's teleporter to go to the Sontaran ship with the atmospheric converter, saying he has to give them a choice before activating it. The Doctor confronts Staal and tries to convince him to leave but the General refuses to lose the glory. The Sontaran fighters prepare to launch, but Luke beams aboard, takes the converter, and send the Doctor back to Earth. The converter destroys the ship just in time.
As Earth recovers from the Sontaran attack, while Donna returns home and Wilfred promises not to tell Sylvia anything. He tells her to go with the Doctor and see the stars. She returns to the TARDIS where Martha and the Doctor are waiting for her. Martha is preparing to leave but the TARDIS doors close on their own and the ship dematerializes on its own. Martha is furious, but there's nothing the Doctor can do.