Ghost in the Machine

"Ghost in the Machine" is the fifth episode of the fifth season of Stargate Atlantis.

Synopsis
While on a mission, Sheppard's team inadvertently brings a mysterious entity to Atlantis. They soon learn that the entity is nothing more than Elizabeth Weir, who was thought to have been killed after her capture by the Asurans.

Plot
Lieutenant Colonel John Sheppard and his team just finished scouting a planet. The team recounts their encounter with "flying monkeys", Doctor Rodney McKay manages to upload a blurry, obscured picture of it. But despite this, the team believes that the planet is to be a suitable Alpha Site. They dial the Spacegate back to Atlantis. However, McKay detects a serious power spike. This is followed by Sheppard's loss of the ability to steer the Puddle Jumper. The power spike has quickly turned into a surge. The surge overloads the Jumper's power, and shuts it down. The drive pods can't retract. The Jumper helplessly collides the edge of the active Spacegate, causing the Jumper to spin, without power, and drifting in orbit. The Gate however, uses its emergency thrusters to put it back into position.

As the Jumper continues to spin slowly over the planet, McKay finds out that the Jumper's power isn't gone, just that it isn't routed to the systems. McKay then discovers that the Jumper is slowing down, which will send the ship to a decaying orbit. Just as the team think they will all die, one of the drive pods reactivates, allowing Sheppard to control the ship and send it through the gate before it shuts down, as the ship's DHD is offline. Soon, power is suddenly fully restored, and they return to Atlantis without any further incidents.

Back in Atlantis, McKay and Radek Zelenka report that nothing is wrong with the Jumper, or any other Jumpers, which makes the team confused, since something must have caused the malfunction. With nothing new to report, everyone returns to their normal duties. Sheppard reports the findings on the planet to Richard Woolsey, who reads it from a tablet. He enters a transporter to the control room. On the way, the transporter's screen flickers. Woolsey exits the transporter, but finds himself on the east pier. He attempts to walk back in to the transporter, but the doors close in front of him. He tries contacting the control room, but there is no answer, meaning he is stuck.

McKay finds the same power surges they encountered in the Jumper on Atlantis' systems, with several complaints from members all over the city. Sheppard just misses another displacement current, and reports back to the control room. There, McKay and Zelenka work on fixing the problem. McKay points out that it couldn't have been the same anomaly from the Jumper, as the ship wasn't hooked up with any Atlantis systems. Woolsey finally returns from his walk around half the city. As they plan to solve the problem of the "screwy" readings, the entire power of Atlantis shuts down: the whole city is dead.

Just as they try to figure out what the problem is, and to deploy people to tell the other members not to panic, Rodney's laptop switches on by itself. He sees text on it. After seeing some gibberish, he sees a "help" message below. Rodney types down "who are you". The entity slowly replies "Elizabeth Weir", putting everyone in shock, as they all thought she was killed. McKay asks the computer questions. She has trouble in communicating, and needs help. She explains that she is trapped in subspace and is finding it hard to control anything, and then powers up Atlantis. When McKay asks more questions, she simply says "help me". Later, McKay and Zelenka channel the combined power of three Naquadah generators to merge the glitches that are causing the surges, meaning they can talk to whoever is claiming to be Dr. Weir. They get a response. At first, an evidently male voice calls out. McKay tweaks with the systems, and Weir tries again, this time with a more female voice. It doesn't sound like Weir, but McKay had done the best he could with her voice. Weir begins by telling everyone that she has missed everyone, says hello to Sheppard again, and is shocked to hear that Woolsey is the new boss. They wonder what happened to her. There, Weir starts to recount the events since when she ordered Sheppard to leave her behind last year in Asuras.

She had been repaired by the other Asurans, and was allowed to join their community. The whole time she spent there, despite being in her new form, she still retained her consciousness. She tried to hide that from the other Asurans, but a few were able to sense it. They were from the remnants of Niam's faction. Weir joined them in their quest for Ascension, but was forced to flee from their homeworld. Their objective wasn't easy, as they could be tracked by Oberoth, but since the destruction of Asuras they had more free space to achieve their goal. Weir took them to a planet to teach them how to meditate, but still couldn't ascend because of a major flaw: they were machines. However, one of the Asurans, Koracen, believed that he had found a way to reach a digital equivalent of ascension. Their consciousnesses would be enabled to exist indefinitely as fields of energy. As such beings they could essentially upload their minds to subspace and let their nanite bodies disintegrate, allowing them to move freely about the galaxy at will. Lia, another Replicator, was understandably skeptical, but Koracen had a willing volunteer, and demonstrated the procedure. The plan worked. After they had shed their nanite bodies, they could work on the next step to the higher plane.

Unfortunately, there was no "next step": they are trapped in subspace, trying to handle the constant motion and deafening noise there. They tried to take refuge in the systems of other races that are technologically advanced, hidden from both the expedition and the Wraith. They even tried Wraith systems, but left due to the unpleasantness. Eventually, Weir broke free and was able to find her way to Atlantis, as the city is the only real way to achieve ascension. She requests to be allowed to send her consciousness into a body, but Woolsey refuses.

However, she takes matters into her own hands. She seals off the section which contains the Nanite creation machine. The team works furiously to regain access to the room. They are prepared to blow the door open, only to find that it opens in front of them. The team is shocked to see FRAN on the other side, who then says her trademark "hello". She claims she is Dr. Weir, but can't prove it, as the Replicators have access to all her memories. She assures them that she poses no threat, revealing that she left the technological specs of the other races, including Wraith. After the team meets to decide her fate, they decide to send her consciousness to Virtual reality, like Sheppard did with Ava.

Meanwhile, Weir talks with Teyla Emmagan, and hears that she has a son, Torren John Emmagan. She also finds out about Kanaan being the father. Sheppard comes into the room, and Weir talks with him. After a while, Weir senses something: the other Replicators have found her, and are on their way to Atlantis. McKay works on a way to filter out the glitches as "viruses". However, before he could implement the programme, the other Asurans arrive.

The city's power surges everywhere, but McKay is able to find a way to communicate with Koracen. The other eight demand to create new bodies so that they could work. Woolsey refuses. In retaliation, Koracen breaks off all contact with the Expedition, but not before hinting that they will comply to his wishes. They cut off the Expedition's access to the city, and powers the ZPM. There, they start to sink the city, to force them to cooperate. However, Woolsey tells Weir to contact Koracen, to tell them that if they don't get what they want, then the city would still sink, everyone will drown, and they will lose their one hope of ascension, and will be "trapped in limbo forever". Weir tries, but there is still no response. Eventually, Koracen stops and restores the city, relieving everyone.

Weir proposes another plan: allow the Replicators to gain bodies long enough to build themselves human bodies, like what they did to Sheppard's team last year, in order to live their lives out as humans. They would require food and water, and would age, but this would also allow Ascension. McKay lets them work on that planby sealing them in a room with a force shield surrounding it. The Replicators start working, with Ronon Dex keeping an eye out in case they have a secret agenda. Ronon was ultimately proven correct.

Koracen worked not on building the new bodies but on a means to shut down the shield, allowing him to escape. Ronon attempts to stop him, but is thrown across a corridor, rendering him unconscious. The other Asurans insist that Koracen acted alone and that the rest wish to achieve their goal. Sheppard pursues Koracen and tries to shoot him, but is unable to inflict any damage. After one encounter, Koracen explains that he does not wish to be human, as he feels the human body is "frail and weak". Afterward, he encounters Weir again. He tells her that she was deceiving them the whole time, and seriously doubts she was Weir all along. Koracen attacks him, but Weir sticks her hand in his head and shuts him down. Koracen quickly turns into a pile of inert nanites.

Later, Woolsey lets their work continue. Weir apologises to them, saying that she believed she and her group would be safe, and realised that the group are too much of a threat. Despite this, Weir has another plan to do the right, by continuing their work on another planet, contacting Atlantis only if they require assistance.

The Stargate is dialed to another planet. The Asurans seem skeptical, but Weir tells them that she will go through first to see if it's safe. After she steps through, she contacts the others to let them know she is safe. However, the second they stepped through, they realized too late that they had been sent to a Spacegate. They start to freeze from the harsh effects of space. After the whole team steps through, McKay points out that this act had answered the question if this was really Elizabeth all along, since McKay had modified the DHD to not dial the entered coordinates, but rather a pre-selected Spacegate. As the Asurans leave, Sheppard grievingly stays behind. In the end, the group of Asurans (including Weir) are now all completely frozen and floating through space.

Notable quotes
Ronon: What the hell was that thing? Teyla: It just appeared out of nowhere. McKay: And that shriek scared the crap out of me. Sheppard: Kind of a... flying monkey. McKay: Flying monkeys! What is this, the planet of Oz?

Woolsey: But the planet. Suitable for an Alpha site? Sheppard: Yeah, perfect. Well, except from the monkey-like creature flying around, but I think we can handle that. Woolsey: Monkey? Sheppard: Yeah, McKay's got some photos. He'll show 'em to ya. Woolsey: Did you say flying?

McKay tweaks a system and tries to talk to Weir McKay: Elizabeth? Weir: (in a deep male voice) Rodney. Sheppard: Is it just me, or does "Elizabeth" sound a little different?

Sheppard: You just couldn't wait for those human bodies, could you. Koracen: The human body is frail, weak; every second that much closer to dying. Sheppard: Yeah, and this whole ascension thing, you're just giving up on that, huh? Koracen: Not at all. I'm certain there's another way. And with this body, I'll have plenty of time to discover it.

Background notes

 * Through the laptop, Dr Weir appears to answer the question, "did you do that?" with "allyourbase", which could be a reference to the internet meme "all your base are belong to us" which originated from the game Zero Wing.
 * The energy version of Elizabeth Weir mentions that she encountered other advanced races in the Pegasus galaxy; with a surprising number existing who are hiding from the Wraith.
 * In an attempt to rebuild themselves, one of the race technologies the energy versions of the Asurans inhabited was Wraith technology.
 * Every other time a human form replicator has been double-crossed by humans, they have come back looking for revenge.
 * The episode made a reference to the The Wizard of Oz. McKay notes that the planet they surveyed has "flying monkeys".
 * Zelenka refers to the Zero Point Module as a "zed PM", the same way McKay pronounces it.
 * The Orbital Spacegate actually has eight chevrons, rather than the conventional nine, the same as the gate on the Asuran Stargate satellite.
 * This is the first episode to show a spacegate using its stabilizers to reposition itself (after being knocked out of place by the Puddle Jumper).
 * Dr. Jennifer Keller does not appear in this episode.
 * This episode indicates a number of countries involved in the Atlantis Expedition through flag patches; Canada, Czech Republic, Italy, Spain and the United States of America.
 * Woolsey mentions that replicators have been the scourge of two galaxies but it's at least three: Milky Way, Pegasus and Ida (Asgard home galaxy).

Goofs

 * As with several other episodes, the spacegates portrayed possess only eight chevrons compared to the nine that all Stargates are considered to have. Most fans (and this wiki) put this down to an oversight on behalf of the SFX team and consider them to have nine-chevrons as far as Stargate canon is concerned.

Production

 * The term "ghost in the machine" was a phrase used in the 1949 book, "The Concept of Mind", written by British philosopher Gilbert Ryle to highlight the perceived absurdity of dualist systems like Descartes' where mental activity carries on in parallel to physical action.
 * Relating to above allusion, the term "ghost in the machine" has drawn alot of attention to various television, films and music titles since the 1949 book was published. It was also the pivotal plot key in the movie "I,Robot". - see for more info.
 * The first draft script for "Ghost in the Machine", written by Carl Binder was handed in on February 12, 2008.
 * The following week, Binder began the script rewrite for the episode.
 * Weir was not played by actress Torri Higginson, who turned down the offer to appear in the episode. Instead the script was rewritten so that the cliffhanger could be resolved and the story continued without her.
 * Archival footage of "Lifeline" and "Be All My Sins Remember'd" were used in this episode.
 * The airing of this episode was delayed by a week, because the opening ceremony of the Beijing 2008 Olympic Games was held on August 8th.