On Atlantis, Ronon assures Sheppard that they've evacuated all of the people from planets in the path of the Replicators' invasion. Sheppard then takes a team to a planet but they're interrupted when Lt. Kemp's team returns with evacuees. Kemp himself is at the other end and says that most of the settlement wants to stay. The Replicators arrive early and open fire, killing Kemp and his remaining men and destroying the Gate.
The Daedalus and Apollo arrive in orbit and Caldwell and Ellis beam down to get a briefing from Rodney. However, Rodney can't implement the destruct coding immediately but asks for 10 hours before they go the military route. Ellis reluctantly agrees.
The Wraith Prisoner notes to Rodney they won't be able to complete the work in time, but Rodney is confident he can put it together. Ellis and Caldwell take their ships out with their advanced beam weapon and take out the first Replicator ship, intercepting them using the tracking system. However, Sam warns that the Replicators will adapt.
One Week Later
Caldwell returns to Atlantis to resupply and they get word that the Replicator fleet is withdrawing, puzzled at how the Atlantis ships are tracking them. Ellis suggests they use McKay's destruct program but Rodney hedges on the fact it isn't ready. He goes back to work but he and the Wraith Leader can't get the destruct program to work. However, he comes up with a new idea: forcing the Replicator nanite cells to bond together into one giant blob. It'll take them time to adapt but they'll self-destruct into a neutron star before then. Sam approves the plan and Rodney uses the device they have that will let them create human Replicators. They beam it down to the Replicator homeworld and set it off. However, Rodney warns there will be delay before it affects the 30 orbital ships, and Sheppard suggests they get more ships. They talk to the Wraith Leader, who says he can bring at least 12 ships to destroy the Replicators but will need to convince them personally. They have no choice but to agree and Sheppard's team (minus Rodney) takes him via Puddle Jumper. They rendezvous with a Hive ship and free their prisoner, but are immediately stunned unconscious by the guards.
Rodney works on the humanform replication device while Zelenka kids him about his recent lack of success. McKay manages to get it working briefly but then it breaks down temporarily. Meanwhile, Sheppard wakes up back aboard the Puddle Jumper to find that the Wraith Leader wanted to speak to his people in private. He says they can provide seven Hive ships for the assault and must return to Atlantis to complete the work with Rodney.
McKay is using a force field to stabilize a Replicator construct but almost as soon as he releases it, the Replicator nanites collapse again. Zelenka is called away to check out power failures in the infirmary while Rodney continues his work.
The Puddle Jumper is returning to Atlantis when a huge ship appears out of hyperspace: the vessel of Larrin and her nomadic people. She takes them prisoner and Sheppard explains their plan, then suggests she help them as well. Her people's allies are being wiped out by the Replicators so she agrees to join the team. Sheppard proposes that the Atlantis technicians help upgrade their ships.
Zelenka returns from his assignment to find that McKay has made progress of a sort: he's created a female android, F.R.A.N. Meanwhile, Sheppard returns to Atlantis and Teyla finally explains that she's pregnant. Sheppard isn't thrilled that she kept it from him, insisting they regularly go into dangerous situations. He relieves her from active duty and walks off, while Ronon offers his congratulations. He promises to help her find her missing mate, Kanan.
Sam and Sheppard go to see F.R.A.N., and McKay explains it poses no danger and is the best he could come up with. Sam isn't thrilled with the idea of sending "her" to its death but reluctantly agrees. However, F.R.A.N. has been analyzing the data and warns them the nanites will regain control before they collapse. She comes up with a solution; they overload the ZPMs around the fused mass, speeding up the process and causing a massive explosion. Ellis is skeptical and Rodney explains he'll have to beam down to the core rooms with F.R.A.N., Ronon, and a squad of marines to set the ZPMs on overload, while they keep the Replicator destroyers in orbit distracted. Sheppard will be aboard Larrin's ship, using his Ancestor gene to attack with their drones.
The massed armada of ships head for the Replicator homeworld while Ellis takes Rodney and others in on his ship. McKay is surprised at the fact that F.R.A.N. is comfortable with her self-destruction. The armada opens fire while F.R.A.N. is beamed down separately and Rodney and his team activate the power core. F.R.A.N. confronts the Replicators and activates her programming, drawing them all to herself. One of the Replicator destroyers tries to escape and Sheppard destroys it, while the other ships are drawn to the surface where the steadily increasing nanite blob grows and sinks into the planet. McKay starts to set the countdown but the mass collapses the power grid, causing a blackout. They have to time the explosion to the nanosecond, but they detect neutronium in the soil. Sam suggests they increase the blob's mass, causing it to sink into the planet where it will implode at the planet's core. Rodney succeeds and they beam out, then most of the ships head for the rendezvous point: the rest are caught in the explosion.
Larrin is appreciative for Sheppard's help and assures Sheppard she'll be in touch. The Wraith never met at the rendezvous point and they figure they'll soon be back at each other. Rodney erases the Replicator homeworld from the database and head out to dinner. But as they do, out in space among the debris of the planet, one Replicator planet hides… with the Replicator Dr. Weir in command.