Ghost in the Machine

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

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

Plot
Lt. Colonel John Sheppard and his team just finished scouting a planet. The team recounts their encounter with "flying monkeys", Dr. 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 Dial Home Device is offline. Soon, power is suddenly fully restored, and they return to Atlantis without any further incidents.

Back in Atlantis, McKay and Dr. 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, McKay's laptop switches on by itself. He sees text on it. After seeing some gibberish, he sees a "help" message below. McKay 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 on 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 Dixon.

Meanwhile, Weir talks with Teyla Emmagan, and learns that she has a son, Torren John Emmagan. She easily intuits that Kanaan could only be the father, as she had noticed long ago that Teyla was in love with him. 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 program, 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 Zero Point Module. 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 plan by sealing them in a room with a 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, Sheppard 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 apologizes to them, saying that she believed she and her group would be safe, and realized 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, and that Elizabeth lured the Asurans to the freezing space. 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 and Zelenka are trying to find out what went wrong on the Jumper when Sheppard enters)

Sheppard: So, how's it going boys? Got it fixed?

Zelenka: There's nothing to fix.

Sheppard: What?

McKay: We've run a battery of tests. The Jumper's in perfect condition.

Sheppard: How come the systems were all screwy?

McKay: You got me.

Zelenka: We couldn't re-create any of the so-called 'anomalies'.

McKay: Hey Sammy Skeptic! (Points to Sheppard) He saw it too, as did Ronon and Teyla! All of our primary systems went down.

Zelenka: That's OK, I believe you.

McKay: I don't think you do.

Zelenka: I just think that maybe the problem might have been caused by something that you unwittingly...

McKay: I didn't do anything, wittingly or un!

(Sheppard backs away)

Sheppard: OK, OK, there's nothing wrong with the Jumper.

McKay: Well, not anymore.

Zelenka: (Under his breath) I don't think there was anything wrong with...

McKay: OK, enough!

(Zelenka walks off, muttering to himself under his breath, whilst McKay looks confused.)

(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?

Woolsey: They certainly don't waste any time do they?

McKay: No they don't. There's no breaks, no chitchat, no social interaction whatsoever, just the perfect working environment.

Woolsey: Ronon, you don't have to stay there the whole time you know.

Ronon: I'm good.

McKay: Talk, talk, talk, that's all he does. You can't shut him up.

Woolsey: Keep me apprised.

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.

Goofs

 * The close up of the Space gate at the start of the episode shows it to have only 8 chevrons, instead of the correct number of 9.
 * After they hit the Spacegate, John Sheppard tells McKay to fix the DHD so that they could dial again and radio for help. However the Gate is still active and he only needs to bring the Jumper back into range.
 * When McKay and Dr. Radek Zelenka are trying to diagnose the first problem with Atlantis all the laptop computers shut down in the lab. Unless for some reason they weren't fitted with batteries (improbable) power loss would only result in the laptop going into battery power mode (lower brightness, etc.) and would continue to operate until those batteries died (around 2 hours on that particular model of Dell laptop). The batteries might have been taken out to avoid damage from constant charging, but the computer screens seem to be blacked out rather than actually turned off.