Ghost in the Machine

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

Plot
Sheppard and his team just finished scouting a planet, believing it to be a suitable Alpha Site, with the exception of the "flying monkeys". They dial the Spacegate. However, McKay detects a serious power spike. Sheppard says that he no longer has access to steering. This was followed by a surge. The surge overloads the Jumper's power, and shuts it down. The Jumper helplessly collides with the active Spacegate, causing the Jumper to spin, without power, and drifting in orbit. McKay finds out that the Jumper's power isn't gone, just that it isn't routed to the systems. However, he finds that it is slowing down, causing a decaying orbit. Just as they thought they would 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. Power is suddenly fully restored, and they return to Atlantis without any further incidents.

Back in Atlantis, McKay and Zelenka report that nothing is wrong with the Jumper. With nothing new to report, everyone returns to their normal duties. Sheppard reports the findings on the planet to Woolsey, who reads it from a tablet. He enters a transporter to the control room, but finds he is 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.

McKay finds the same power surges they encountered in the Jumper, on Atlantis' systems. 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. Suddenly, the power of Atlantis shuts down -- the entire city is dead.

Just as they try to figure out what the problem was, Rodney's laptop switches on. He sees text on it. After seeing some gibberish, he sees a "help" message. Rodney wonders who this is. The entity replies "Elizabeth Weir". She has trouble in communicating, and needs help. She explains that she is trapped in subspace, until she turns Atlantis' power back on. 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. It doesn't sound like Weir, but McKay had done the best he could with her voice. Weir begins by telling everyone of the events since she ordered Sheppard to leave her behind last year in Asuras.

She had been repaired by the other Replicators, 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 replicators, 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 had to flee from their homeworld. Their objective wasn't easy, as they could be tracked by Oberoth. But since the destruction of the planet they had more free space to achieve their goal. Weir was able to teach them how to meditate, but still couldn't ascend because of a major weakness; they are machines. However, one of the Replicators, 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 of subspace. They tried to take refuge in the systems of other races that are technologically advanced, hidden from 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 contained 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 opened. On the other side is FRAN. 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. After the team meets to decide her fate, they decide to send her consciousness to Virtual reality, like Sheppard did with Ava. After a while, Weir senses something; the other Replicators have found her, and are on their way to Atlantis. Sooner than later, they arrive.

The city's power surges everywhere, but McKay is able to find a way to communicate with Koracen. The other eight Replicators demand to create new bodies so that they could work. Woolsey refuses. Koracen breaks off all contact with the Expedition, but not before saying that they will comply. They start to sink the city, to force them. 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. Eventually, Koracen stops and restores the city.

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 to live their lives out as humans, so they could eat, sleep, age, and be able to ascend. McKay lets them work on that plan, to seal them in a room with a force field surrounding it. The Replicators start working, with Ronon keeping an eye out in case they have a secret agenda. A theory, later turning out to be correct.

Koracen, has worked on a system to shut down power and escape. He does so. Ronon attempts to stop him, but is thrown across a corridor, rendering him unconscious. The other Replicators 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 probed Koracen's mind and had him terminated.

Later, Woolsey lets their work continue, but on another planet. They promise to contact Atlantis only if they need help. They dial the gate to another planet. Weir comes 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 they went to space. Weir realizes that she and the other Replicators are too much of a threat, and thinks this is a best solution to neutralize them, as the environment of space freezes them. McKay points out that this act had answered the question if this was really Elizabeth. In the end, the group of Replicators (including Wier) are now frozen and floating through space.

Production

 * 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.