Dr. Beckett is administering medical relief to a village when Sheppard and his team visit to provide him with additional medical supplies. He reveals that a number of the people living in the village, the Balarans, are survivors of the Hoffan drug: The residents came from a planet infected by Michael and were taken in by the locals. Beckett introduces them to Novo, a survivor working as his assistant. As they go to dinner, they hear a woman scream and investigate, finding a squadron of Wraith soldiers entering the village.
The Wraith Commander asks to speak to the village head, Elson, and informs him that they want the plague survivors turned over to him. If the villagers refuse, they will die when his Hive ship arrives that night. The Wraith leave and Beckett explains to Novo that she and the other survivors are poison and the Wraith won't suffer them to leave. As the villagers elders vote on what to do at the mine office, Sheppard sends Ronon and Teyla to scope out the Stargate while he talks to the elders and explains what's going on. Sheppard notes that the Wraith won't know who the Balarans are unless the villagers betray them as outsiders. Sheppard offers to move the entire village to another planet but one of the elders, Jervis, considers turning the Balarans over. Teyla calls Sheppard to inform him it isn't heavily guarded and they can get past him. Sheppard warns the village elders there's no guarantee that the Wraith will keep their word. They agree to his plan and Sheppard tells them to take what they can carry, the goes to get Rodney. Beckett insists on going but Sheppard orders him to stay with the villagers and get ready to move them out.
Teyla and Ronon move toward the Stargate but more Wraith return from patrol. Teyla warns Sheppard that they're stuck there. He tells the villagers he can't get them out and Atlantis won't send reinforcements before the Hive ship arrives. Jervis pushes for the village to act and goes out. Sheppard goes to the tavern where he finds that Beckett has sent most of the Balarans back to their homes. Meanwhile, Jervis leads a group of like-minded villagers in rounding up the Balarans. Novo's host, Renni, tells Jervis that Novo is gone. Novo and her boyfriend Safaris are attempting to leave with some of Balarans but Jervis' people find them. Ronon and Teyla arrive and Jervis his people arrive and demand that they hand over the ill Balarans under Beckett's care. Jervis insists it's now up to him and the others to handle the situation, and Elson insists that it isn't their way. Beckett challenges Jervis to shoot the Balarans and spare them torture at the hands of the Wraith. Jervis yields but tells them h is men are on the way to the Stargate with the first group of captured Balarans.
Novo and Safaris are among those at the Stargate being inspected by the Wraith. Meanwhile, Sheppard's team secure Jervis and his men and they decide to get the remaining Balarans to a nearby mine shaft to hide. In orbit, the Hive ship arrives and the Wraith Commander informs the prisoners they will shortly be moved. Safaris offers the Wraith Commander a deal: there's someone hiding in the village of greater value than all the Balarans combined. He puts his life on the line to convince him.
Beckett and McKay are getting some necessary supplies from the clinic while Sheppard and others take the Balarans to the mine. Safaris brings the Wraith and they stun both men, and then kill Safaris. As Sheppard and the others get the Balarans into the mine, they hear Darts overheard. Sheppard is unable to contact McKay and Beckett and goes back to the village just in time to see the Wraith and their prisoners teleported aboard a Dart fighter.
McKay and Beckett wake up and McKay tries to come up wit a plan. The Wraith Commander arrives and escorts them to a lab where they've been studying the plague. He reveals his head scientist died trying to detect the poison. Now he wants Beckett to continue his research and find a way to detect it. When Beckett refuses, the Wraith threatens to kill everyone on the planet if he doesn't cooperate.
Sheppard grabs Jervis and demands to know who betrayed Beckett to the Wraith. Jervis suggest Sheppard talk to the Balarans. Meanwhile, McKay determines he can't access the ship's systems through the lab computers. Beckett admits that he can't create a detection device because of the massive loss of life. McKay suggests he stall but Beckett is feeling guilty over his part in the development of the Hoffan drug.
Sheppard returns to the mine shaft and notes that he has a plan, but it will take some work. Meanwhile, Beckett finds something but won't tell McKay and demands to talk to the Commander. Once there, he tells the Commander he's not going to help them, and people will doe no matter what he does. The Commander threatens to drain his life force but Beckett refuses to yield and is fed upon. However, the Commander collapses and Beckett explains that he used their samples and did a test on himself. The Wraith Commander dies at his feet and he grabs a blaster and shoots his way out. Beckett goes back to the lab and frees McKay, then deletes the research data.
They head out and McKay explores the ship until he finds a communications panel. He contacts Sheppard on the planet and tells him what's happened. Sheppard needs them to take out the Hive ship's main weapons. McKay reluctantly agrees and Sheppard and the others move out. Elson, who has been listening to everything, slips away and frees Jervis, saying he was right all along. He suggests Jervis contact the Wraith and have them honor the original deal. Jervis says he'll need all the Balarans at once and Elson gives them their location in the mine shaft.
The Commander's crew discovers he's dead and close in on McKay and Beckett. Beckett holds them off long enough for McKay to deactivate the main weapons and call up the schematics for the ship. They head for the flight bay and they get into a single Dart, but can't get it started. The Wraith start to blast through the doors and McKay comes up with an idea, but tells Beckett to get out of the Dart.
Jervis takes the Wraith to the mine shaft but the Balarans are gone. The Wraith find a packet of C4… and Sheppard triggers it from the Stargate. Elson is there, and Sheppard thanks him for his effort. The Wraith in orbit get word of the explosion and open fire on the Stargate, only to discover their weapons aren't working. Sheppard and the others dispose of the Wraith guarding the Stargate then open a wormhole. Meanwhile, the Wraith are unable to detect Beckett and McKay, and order more Darts to attack the Stargate. One Dart flies above… and McKay and Beckett are teleported down. McKay stored them both inside of the buffer system and programmed the Dart ship to beam them down when it approached the Stargate. They all get through the Stargate just in time.
Back on Atlantis, McKay asks Beckett to dinner. Beckett reveals he's going with the villagers to a new planet, and he's going over Keller's data. Beckett notes he can't take the data with him, and accepts McKay's offer at all.