The ATMOS converters from millions of cars spew gas into Earth's atmosphere. Sylvia saves Wilfred by smashing open the car window and the two of them get into the house with the Doctor and Donna. Colonel Mace and his men are trying to deal with their own ATMOS-equipped vehicles at the factory. As they do so, the Martha clone created by the Sontarans is accessing the NATO defense codes through the UNIT computer and downloading them onto a PDA.
The Doctor goes back to the factory and Donna decides to go with him, even though the Sylvia warns the Doctor is dangerous. Meanwhile, the Martha-clone contacts General Staal aboard his orbital cruiser to let him know she has the codes, and Luke Rattigan is smugly triumphant.
When the Doctor arrives at the factory, Martha gives Mace the Doctor's earlier warning so that they won't suspect anything. The Doctor gives Donna a TARDIS key for the first time and tells her to stay in the TARDIS, then tells Mace that he and Martha will use the TARDIS to go up to the Sontaran ship. The Martha-clone notifies the two brainwashed UNIT troopers, who attach teleport devices to the TARDIS. Staal teleports it up to the ship while Luke teleports back to his academy to mobilize his students into a military force. After he leaves, Staal notes that Luke and the other humans have no idea what he has planned.
The Doctor and the Martha-clone discover the missing TARDIS, and the Doctor notes that she doesn't seem concerned about her fiancé or family. She assures him they'll be fine.
Luke arrives back at the academy and finds the gifted students staring out at the nearby city, which is blanketed in gas. He assures them that they have nothing to worry about.
The UNIT research team determines that the gas isn't immediately fatal but when it reaches an 80% concentration, everyone will die. They've also traced the activation system back to the Sontaran battlecruiser, pinpointing its location. The Doctor contacts Staal and accuses him of being a coward, but Staal refuses to lose his temper or reveal his plans. He displays the stolen TARDIS and the Doctor manages to slip in some phrases for Donna's benefit. She's watching on the TARDIS monitor and gets the message to call him on her cell phone. Due to the Doctor's taunting, Staal has his men take the TARDIS to a storage closet.
Luke explains to the students that the Sontarans will be giving them a new world to colonize and they can form a new society. The male students are unimpressed and the female students even less so when they hear Luke has breeding plans. He draws a gun to try and force them to stay but they ignore him and leave, and he can't bring himself to shoot them.
Donna calls her mother and granddad from the TARDIS and assures them that the Doctor will save the day no matter how hopeless it looks, but Sylvia isn't convinced.
The Doctor realizes that the gas is more than a simple poison and concludes Staal has some other plan. As the gas concentration rise, Colonel Mace orders a nuclear strike on the Sontaran battlecruiser. The Doctor warns against it. In orbit, Staal is aware of everything from the Martha-clone and is unconcerned. He orders Commander Skorr to lead an assault on the factory.
Mace orders a missile launch… and nothing happens. The Doctor is relieved but puzzled, noting that no Earth nuclear weapon could have damaged the battlecruiser. He wonders why Staal stopped the launch.
Staal orders Skorr and his men into the factory with orders to protect their operatives. The UNIT soldiers try and fight back but the Sontarans are using a suppression system that prevents their copper-lined bullet from firing. The aliens decimate the defending troops and Mace is forced to order a retreat. The Doctor wonders why the Sontarans are bothering to retake the factory.
Luke returns to the battlecruiser and Staal informs him that his promises to Luke were lies: he planned to have his men gun down the students if they arrive. He orders his men to execute Luke but the boy quickly teleports back down to the Academy. Staal is unconcerned and orders the deadlock of all teleport links to the battlecruiser.
The Doctor concludes there's something the Sontarans need at the factory. While Mace comes up with new bullets unaffected by the suppression system, the Doctor contacts Donna and tells her he has no choice but to ask her to cancel the deadlock so he can get to the ship. Following his instructions, she disables the Sontaran guard by striking his probic vent with a hammer, and then makes her way through the hallways.
The Doctor stays in contact with Donna while donning a gas mask and going with Mace and his men. Mace announces that they've come up with bullets that will function despite the Sontarans, and gives a rousing speech. He calls in the UNIT air-carrier Valiant
and uses its propellers to blast away the gas, then fires its salvaged alien cannon. The UNIT soldiers then move in while the Doctor takes the Martha-clone down to the basement. He gets in and finds the real Martha, held prisoner so her memories can "power" the clone. He reveals that he could sense how the Martha-clone was a fake from the very beginning, but didn't do anything so she would stop the missile launch and prevent a nuclear holocaust. He yanks the wires from the real Martha, causing the clone to collapse, dying.
In the factory, Mace finds Skorr and shoots him. Skorr dies satisfied, having been killed in battle.
Following the Doctor's instructions, Donna cancels the deadlock and the Doctor works to reestablish the link from the teleportation unit in the factory subbasement. Martha tries to convince her clone to help and it reveals that the gas' primary function is as a clone feed: the Sontarans plan to use Earth as a breeding farm to create billions of new soldiers for their war against the Rutan. It admits that due to her shared memories with Martha, it knows everything that it can never have and then dies. Martha takes back her engagement ring as the Doctor reenables the teleport system and brings Donna to Earth just ahead of two Sontarans who have discovered her.
The Doctor teleports the TARDIS back to Earth and then teleports the trio to the teleport unit at the Rattigan Academy. Luke is there, guilty as well as angry at being tricked by Staal. They ignore him and the Doctor adapts the converted he saw at the lab earlier to make an atmospheric converter. With time running out, the Doctor runs out onto the Academy grounds and fires the device. The converter ignites the gas, destroying it and purifying the atmosphere. However, the Doctor warns that now Staal will revert to type and launch a full military assault.
The Doctor prepares to go to the Sontaran ship with the converter, which he can use to ignite the atmosphere on the battlecruiser. When Donna wonders why he has to go and sacrifice himself rather than send the device up by itself, he affirms that he has to be there to give them a choice. He teleports up and tells Staal to leave, that his superiors will never know what happened. Staal refuses to concede, ignores the Doctor's threat, and orders the fighters to launch. The Doctor prepares to activate the converter… but Luke arrives, takes the converter, and shoves the Time Lord into the teleporter. The furious Luke activates the converter, sacrificing himself to destroy his betrayer.
While the world recovers from the gas, Donna visits her granddad and tells him that she's leaving again with the Doctor. Wilfred promises not to tell Sylvia anything. Donna goes back to the TARDIS where the Doctor is preparing to dematerialize and Martha is saying her goodbyes. However, as soon as Donna is inside the TARDIS doors close and the ship dematerializes on its own, as an angry Martha demands the Doctor do something.