Shortly after Atlantis left the Pegasus Galaxy to stop an attack on Earth by the super-hive, a new Wraith Queen emerged named Queen Death. A powerful Queen, Death began uniting the Wraith hive ships under her control and feeding on what worlds pleased her and destroying what she couldn't eat. Several worlds were destroyed in this manner by Queen Death and her forces.
After being forced to join Queen Death, Guide learned of her plan to Cull the planet of Levanna next and offered the Atlantis expedition the location of Queen Death's next big Culling in exchange for useful information on the Hoffan plague. Guide eventually told them Queen Death's intention was to attack Levanna and the expedition warned the people of the coming attack. As General Safren Valless was taking the threat seriously, Sheppard contacted Atlantis but Richard Woolsey only agreed to send a Marine unit since he worried that the attack might be a diversion for another attack elsewhere. Ladon Radim of the Genii agreed to send a machine gun unit led by Colonel Faber as well to aid in the battle.
The defending forces began preparing their plans for the coming attack. The Levannan Science Institute had come up with a way to create barrage balloons to lift chains into the air and obstruct the path of Wraith Darts into the city and perfected them with the help of Doctor Rodney McKay. General Valless evacuated the civilian population of the city to nearby caves while both the Marines and Genii led a squadron covering the Stargate. Along with the barrage balloons, General Valless set up his men in the city buildings to support machine gun nests set up by the Genii while the Marines would act as shock troops to keep the Wraith forces from massing. (SGA: "Enemy at the Gate", "Legacy: Homecoming")
After waiting over half of the third day, the Stargate activates from off-world and Wraith Darts come through. Teyla also detects a Wraith cruiser in orbit which Diaz confirms. Culpepper radios in the unscheduled Stargate activation while the Levannans signal General Valless with flares. Hearing that the Darts are arriving, Lt. Colonel John Sheppard orders the defenders to implement Plan A. The defenders in the Gate field open fire on the Darts while the ones who approach the city fall for the trick with the barrage balloons and stay too high for their Culling beams to be used with any accuracy. Sheppard begins making his way to the Marine command post just outside of the city walls, ducking a Dart which is shot down and crashes in the city. In the command post, Diaz informs him that like Sheppard expected, the Wraith came to Cull first and then attack and didn't expect the Levannans to fight back. Ronon reports to Sheppard that the Marines shot down two Darts, the Genii took out another couple and the Satedan Guard shot down one as well. Knowing that there are thirty to forty Darts that have come through the Stargate, Sheppard warns Diaz and Ronon that the Darts are still falling for the barrage balloons but will soon realize they can't Cull and will drop Wraith warriors. Sheppard orders the two to take out as many Darts as they can before that can happen. Diaz informs Sheppard that while they're holding their positions in the Gate field, they don't really control it and can't reach the DHD. The Wraith are also keeping the Stargate open to prevent escape as per their standard practice. Seeing another wave of Darts emerge from the Stargate, Sheppard allows Diaz to join his men while a Dart is shot down and crashes into the woods and another is reported by Ronon to have crashed into the city. Sheppard contacts Teyla who informs him that her and McKay's group at the Science Institute witnessed two Darts go down in the city, but see no fires breaking out yet and the Darts are still avoiding the barrage balloons.
Moments later, another wave of Darts emerge from the Stargate followed by five Wraith stun bombs. Sheppard quickly calls out a warning to his men as the bombs activate and Wraith warriors finally emerge from the Stargate, firing. Sheppard orders Culpepper to fall back to Position B, but Morgan answers instead, telling him that Culpepper is down and he acknowledges the order. While the Genii protest falling back as they believing they can hold the Wraith, Sheppard reiterates the order as they are not trying to hold the Stargate. Moments later, Teyla informs him that the Darts no longer see the barrage balloons as a threat and are working to cut them down. Sheppard fires on a passing Dart, but it escapes damage and Sheppard warns Valless that the barrage balloons are no longer effective. Valless acknowledges this and informs Sheppard that the Darts are now dropping Wraith behind his position and he is sending out Colonel Laecat and his men to deal with them. Sheppard then orders all forces to go to Plan B.
As Sheppard's men prepare to move into the city to defend it from the Wraith warriors dropped by the Darts, Ronon reports that the Wraith have been deposited in grids A5, J7, C6 and C5. Valless recognizes that grid J7 is a decoy designed to draw off their forces and orders the Wraith in that area be ignored. Instead, he orders Sheppard to grid C5 to support General Kolbyr's troops and Colonel Faber to A5 to support General Chacier. Sheppard has Diaz and Morgan join him with each of the three men taking command of a squad while Ronon is left behind to command the reserves.
Sheppard, Diaz, Morgan and their men make their way through their assigned grid of the city, following the sounds of gunfire to find where they are needed. As they go, Sheppard witnesses a barrage balloon crew trying to set up another balloon only to be caught in the Culling beam of a Dart. As they continue through the city, the men unexpectedly run into a Dart's Culling beam which deposits a dozen Wraith warriors and a single Wraith Commander. Before the Wraith can react, the humans open fire and kill the Wraith without taking any fire themselves. Sheppard and his men then began fighting house to house, dodging from shelter to shelter and hoping to spot the Wraith before the Wraith can spot them. As they go, a young Marine is attacked by a warrior and drained of his life before his squadmate can kill the Wraith.
Sheppard's men are able to clear the area around the Levannan Science Institute, but the Darts and the Wraith keep coming unrelenting. The Genii, who had disobeyed orders to fall back when the Wraith warriors started arriving, start falling back towards the city wall, taking casualties and coming under threat of being pinned down and killed against the wall. In response, Valless sends the Satedan Guard to aid them. However, Sheppard recognizes the fact that there were too many Wraith in the city and they were spending too much time and men trying to clear them out. Reflecting on how some missiles would've been useful, Sheppard contacts McKay who informs him that the Institute was attacked by the Wraith and though they repelled the attack, one of the scientists got fed upon. Sheppard asks if McKay has flares or fireworks he can shoot at the Wraith and McKay confirms that the Institute is where the Levannan flares are made so they have them, but doesn't believe they will do any good as they aren't dangerous. Sheppard informs McKay he just wants to scare the Wraith and clear the city's airspace even temporarily and requests that McKay get together as many flares as he can and get them set up so they can be fired off at once. McKay confirms he can do it and asks for fifteen minutes to set up though Sheppard only gives him ten. Sheppard then contacts Valless and explains his plan to the general. Valless tells Sheppard that the Wraith are concentrating their attack on the Genii positions believing rightly that if the Genii fall, the humans will lose the battle. Valless decides to send Kolbyr and Chacier's men to support them and order them not to engage until Sheppard sets off his distraction. Sheppard informs Diaz and Morgan of the situation and orders Morgan to join the men reinforcing the Genii. Sheppard orders that once the distraction of the flares goes off, Diaz and his men are to take out any Darts that they can and then mop up any Wraith still left in the city. The Marines Smith, Alvarez, Rey, Nguyen and Jeleniewsi join Sheppard while the rest go with Diaz.
Sheppard's group enters the Science Institute where Teyla explains that the Wraith who had attacked them got in through the roof but a Satedan named Tarl had noticed them in time to prevent serious loss of life. Sheppard finds that McKay has bundled the flares together and Teyla assures Sheppard that they can enact his plan. After Sheppard's team confirms that the roof is still clear, McKay and the scientists set up the bundled flares and hand out more in the form of flare pistols to the Marines and Sheppard. McKay lights the flares which all go off at once while the Marines, Sheppard and the scientists fire their flare pistols a second later. The light from the flares blinds the pilot of a nearby Dart and Sheppard, Teyla and a Marine shoot him down. Believing the flares to be deadly weapons, the Darts quickly retreat through the Stargate as do all the Wraith nearby. General Valless reports to Sheppard that the Genii held their position and the Wraith are retreating while McKay is left stunned that Sheppard's bluff worked.
Following the retreat of the Darts and the Wraith that came through the Stargate, the Levannans, Tau'ri and Genii spend most of the rest of the day going through the city looking for any surviving Wraith. They eventually locate and kill all of the Wraith left on Levanna and the Levannans cut off their heads to ensure they won't regenerate. (SGA: "Legacy: Homecoming")
Following the battle, the injured are treated with Doctor Carson Beckett coming to Levanna to help while Atlantis' injured are transferred back to the city. Sheppard debriefs with General Valless while Colonel Faber is enraged as Sheppard didn't come when Faber called for help. However, General Valless informs him that he held back Tau'ri help since the Genii Colonel had disobeyed his orders to fall back and got himself in over his head before Sheppard's distraction saved him. Angry with Faber's actions and attitude about it after he had agreed to place himself under Valless' command, Valless orders the Genii off Levanna. (SGA: "Legacy: Homecoming")