Enemy at the Gate (Stargate Atlantis)

"Enemy at the Gate" is the 100th and final episode of the science fiction television series Stargate Atlantis. The episode aired on January 9, 2009 on the Sci Fi Channel in the United States, and on January 13, 2009 on Sky1 in the United Kingdom. Written by Joseph Mallozzi and Paul Mullie as their fifth and final script in the fifth season, "Enemy at the Gate" was produced as the nineteenth episode of the season and was directed by Andy Mikita. It is dedicated to Don S. Davis (Stargate SG-1 George Hammond), who died from a heart attack in 2008.

"Enemy at the Gate" involves a Wraith plan to significantly upgrade a Hive Ship by integrating it with stolen Zero Point Modules from Asurans, and picks up a weak transmission from Earth from an alternate reality ("Vegas"), alerting the ship to Earth's location.

Plot
"Todd" (Christopher Heyerdahl) informs Atlantis that a group of Wraith have multiple ZPMs and they plan to use one of them to power a new super Hive Ship. "Todd" urges the expedition to destroy it, but when the team reaches the hive, they realize that the ZPM has already made the ship far more powerful than expected, and causes significant damage to Daedalus before jumping into hyperspace. The team then finds out that the Hive has picked up a subspace transmission from the alternate reality depicted in "Vegas", giving the Wraith the location of Earth. Earth sends Apollo and Sun Tzu to stop them, but the two ships are quickly disabled. Lt. Col. Sheppard (Joe Flanigan) gates to Earth and warns Carter (Amanda Tapping) of the situation. However, before their plan of fitting nukes on the F-302s is complete, they discover that the ship has already arrived, and is sending a large squadron of darts, which perform a kamikaze run into Area 51, destroying the Antarctic Ancient control chair, and ZPM losing hope of using the Antarctic drone weapons against the ship. Sheppard, however, plans on using his F-302 to break into the Hive, where he might detonate a nuclear weapon destroying the Hive from within.

Meanwhile, Carson Beckett (Paul McGillion) returns and flies the city to Earth, after finding more ZPMs from "Todd". However, the stardrive shuts down just as they approach the Milky Way. Zelenka (David Nykl) is able to implement a "wormhole drive", which sends the city to Earth within seconds. Meanwhile, in attempting to gate to Earth the Atlantis expedition connects to a Stargate aboard the Hive, which has been brought for the purpose of superseding Earth's gate to prevent dialing out. Woolsey (Robert Picardo) sends Teyla (Rachel Luttrell), Ronon (Jason Momoa), McKay (David Hewlett) and Lorne (Kavan Smith) to the Hive to destroy it. However, in the process, Ronon is killed. The team find Sheppard about to detonate the nuke, but stop him. Since the Hive is over Earth, they plan to remote detonate the nuke, after they safely gate to the Alpha Site. They find Ronon, who was brought back to life by the Wraith and rescue him. Meanwhile, Atlantis arrives to destroy the ship, but the powerful weapons push Atlantis into Earth's atmosphere. Before the shield fails, the Hive is destroyed by the nuclear warhead. Atlantis is burning up on re-entry, though Carson manages to control the city, and lands in the Pacific Ocean, subsequently cloaking and secretly moving Atlantis to the coast off San Francisco. In the end, the team takes time to admire the view of the Golden Gate Bridge.

Production
Even though "Enemy at the Gate" is the final episode in the series, its production number was 519, leaving 520 for "Vegas", which was filmed on location in Las Vegas, Nevada. The shooting of "Enemy at the Gate" overlapped with "Vegas", which was not unusual as Atlantis used to film multiple episodes at the same time during its run. The VFX budget was over half a million dollars, only being seconded by "The Daedalus Variations" for the most VFX dollars spent on an episode in season 5.

Many of the happenings in "Enemy at the Gate" were originally planned because the episode was the 100th episode as well as a season finale. When the writers learned of the cancellation, they found the events even more appropriate to serve as series finale. In writing the episode, the writers had to take a lot of backstory into account. It needed to be addressed that the Atlantis characters did not necessarily know the recurring characters from the Stargate franchise such as Major Davis. Stargate Atlantis was originally intended to be continued by a two-hour movie, but MGM filed for bankruptcy in 2010 and shelved the Atlantis film indefinitely.

Because it was not very clear to the audience, Paul Mullie explained that the "Todd" character "is very much back to being a full-fledged human life sucker at the beginning of this episode", and gave this as the reason why Sheppard appears so cruel to "Todd". The original first scene included explanatory dialog, which was cut when SciFi asked for a Keller scene earlier in the show so that her appearance in the last third would not be as jarring. New explanatory dialog that Mullie added to the first act of the script was filmed but later cut for time. There are plans to make the trimmed and cut scenes available in a special extended version, likely to be released on DVD. Brad Wright temporarily considered to use the wormhole drive as a set-up for a similar drive in Stargate Universe, but instead, this technology is planned to appear as part of the story for the Atlantis film.

The last scene's possible connection to Star Trek is pure coincidence. The producers had wanted the city to come down on Earth near a recognizable landmark, as to be different from the previous five years of the show where Atlantis was always located in the middle of the ocean. Martin Gero and Carl Binder were insistent that it should be the Statue of Liberty, but the geography was not plausible enough for leaving the city cloaked for any length of time without anyone noticing and/or getting killed. So the producers settled on San Francisco and the Golden Gate Bridge.

Although the producers knew of Don S. Davis' (George Hammond) heart problems, his death "came as a total shock" to them. They originally talked about just showing an "in memoriam" card at the end of the show, but as Davis's death also meant the end of the character's arc, they decided to acknowledge it by renaming the ship.

Release and reception
After its US release, "Enemy at the Gate" received a Neilson rating of 1.5, making Stargate Atlantis the second-highest rated Sci Fi series of the week, with the lead being the finale of Sanctuary, which earned a 1.6 rating. In total, "Enemy at the Gate" was viewed by 2.02 million people, including 973,000 for in the 18 to 49 demographic, and 1.12 million age 25 to 54. In the UK, the finale was viewed by 633,000, placing Stargate Atlantis third in the top ten for Sky1 in that week, behind The Simpsons and season seven premiere of 24. However, IGN reviewer Tory Ireland Mell has given the episode a "mediocre" score of 5.8 out of 10, where the reviewer felt that everything on the episode was "forced", and felt the final scene was "uninspiring", though the episode was praised for the conversation between Sheppard and Carter. Sci Fi Wire said that the episode was a very "Satisfying conclusion" for the series end. The episode won the awards for "Best Overall Sound in a Dramatic Series" and "Best Sound Editing in a Dramatic Series" at the 2009 Leo Awards.