"The City on the Edge of Forever" is the twenty-eighth and penultimate episode of the first season of the American science fiction television series Star Trek. It was written by Harlan Ellison; contributors to and/or editors of the script included Steven W. Carabatsos, D. C. Fontana and Gene L. Coon. Gene Roddenberry made the final re-write. The episode was directed by Joseph Pevney and first aired on NBC on April 6, 1967, with a repeat broadcast on August 31, 1967.
In the episode, Doctor Leonard McCoy (DeForest Kelley) accidentally overdoses himself with a dangerous drug. He transports himself down to a mysterious planet while not in his right mind and is pursued by a rescue party led by Captain Kirk (William Shatner) and Spock (Leonard Nimoy), who soon come across the Guardian of Forever, a sentient time portal. McCoy travels back in time while impaired and changes history to such an extent that the Federation of Planets no longer exists, and Kirk and Spock follow him to Depression-era New York City to attempt to fix the damage. While in the past, Kirk falls in love with Edith Keeler (Joan Collins), a soup kitchen operator who dreams of a future much like his own 23rd Century. However, he and Spock eventually realize that to save their timeline, they must allow Keeler to die.
The episode received widespread critical acclaim and has been frequently stated to be the best episode of the entire Star Trek franchise. Elements such as the tragic ending were highlighted by several reviewers. It won several awards, including the Writers Guild of America Award for Best Episodic Drama on Television (Ellison, 1967) and the Hugo Award for Best Dramatic Presentation (Ellison and Pevney, 1968).
Plot
While the USS Enterprise orbits a mysterious planet causing time distortions, Chief Medical Officer Leonard McCoy is treating an injured Lt. Sulu when the Enterprise is rocked by another time wave and McCoy accidentally injects himself with a huge dose of cordrazine, a dangerous drug. Driven into a mad frenzy, McCoy screams "Killers! Assassins! I won't let you!" and flees from the bridge and beams himself down to the planet. Captain James T. Kirk follows with a search party that includes first officer Mr. Spock, chief engineer Mr. Scott, and communications officer Lt. Uhura. On the planet's surface, they come across an ancient glowing ring which turns out to be a sentient object called the "Guardian of Forever", a portal capable of sending them to any time and place. The Guardian offers to send them back to Earth's past and plays a series of images of historical times which Spock records on his tricorder for research purposes. While the others are distracted, the still-frenzied Dr. McCoy bursts out from his hiding place and jumps through the portal. The landing party instantly loses contact with the Enterprise, and the Guardian explains that McCoy has altered the past to such an extent that the Enterprise and the reality they knew no longer exists.
The Guardian says that it's possible to fix the damage, so Kirk requests that it replay the historical period it was showing when McCoy passed through. He and Spock attempt to jump through at a point in time just before McCoy's arrival and find themselves in New York City during the Great Depression. They steal clothes from a fire escape to blend in, and while fleeing from a policeman, hide in the basement of the 21st Street Mission. There they meet the soup kitchen's operator, Edith Keeler. She senses something odd about the intruders but nevertheless offers to pay them to clean up the basement and finds them a place to stay. Later, Spock attempts to discover how McCoy changed history by accessing the recordings on his tricorder. This is a difficult task using the available technology of 1930, which Spock likens to "stone knives and bear skins". While Spock works on the engineering problem, Kirk pays their expenses by doing odd jobs at the 21st Street Mission, where he falls in love with Keeler.
Unknown to Kirk and Spock, McCoy finally arrives in a highly agitated state and stumbles into the mission, where Keeler nurses him back to health. Spock completes his work and discovers that Keeler was supposed to die in a traffic accident but was somehow saved by the arrival of McCoy, creating an altered timeline in which she founded a pacifist movement on the eve of World War II. It grew powerful enough to cause the United States to delay its entrance into the war, allowing Nazi Germany time to develop the first atomic bomb and use it to conquer the world. Kirk is shaken by this revelation and admits his love for Keeler, to which Spock responds that she must die to prevent millions of deaths and restore the future.