[[quoteright:320:http://static.tvtropes.org/pmwiki/pub/images/the_city_on_the_edge_of_forever_1927.jpg]]
[[caption-width-right:320:''"'Let me help.' A hundred years or so from now, I believe, a famous novelist will write a classic using that theme. He'll recommend those three words even over 'I love you.'"'']]

[floatboxright:
Series: Series/{{Star Trek The Original Series}}\\
Episode: Season 1, Episode 28\\
Title: The City On the Edge of Forever\\
Previous: The Alternative Factor\\
Next: Operation: Annihilate!\\
Recapper: {{Tropers/Deckard}}]

In the penultimate episode of the first season (based on a treatment by Creator/HarlanEllison), the crew of the ''Enterprise'' finds itself exploring a [[NegativeSpaceWedgie "temporal disturbance"]] near an unknown planet. Electromagnetic interference causes the ship's computer to explode, injuring Sulu. [=McCoy=] runs to prepare an injection of super-adrenaline for him, but turbulence causes him to [[IntoxicationEnsues accidentally inject himself]] and become BrainwashedAndCrazy. [=McCoy=] escapes the bridge and beams down to the planet.

Following him, the landing party discovers [[RuinsForRuinsSake a city of ancient ruins]] that appears to be uninhabited and empty except for a mysterious glowing green archway, which [=McCoy=] runs through and disappears. The crew notices the archway, which appears to be sentient and exhibits [[PsychicPowers strange telepathic abilities]], acts as a viewscreen displaying various scenes from Earth history. The archway, which calls itself the Guardian of Forever, explains that it is a [[PortalToThePast portal to any place and period in history.]]

Upon losing contact with the ''Enterprise'', the crew realize that [=McCoy=] has somehow altered the course of history since entering the portal. In order to return to their ship and restore the original timeline, they must follow him and prevent him from doing whatever he did. Steeling themselves to find the correct moment in history, Kirk and Spock jump through the portal and arrive in UsefulNotes/NewYorkCity during TheGreatDepression, where the pair must disguise themselves while they search for [=McCoy=]. Unfortunately, their Starfleet uniforms (and Spock's Vulcan ears) [[HighlyConspicuousUniform attract unwanted attention]]. When the pair attempt to steal clothes, they are chased by the police and end up hiding in the basement of a homeless shelter run by the kind, [[WideEyedIdealist idealistic]] [[BrainyBrunette and smart]] social worker Edith Keeler (Creator/JoanCollins). Keeler offers to take in Kirk and Spock and find them work, although she is slightly suspicious of their [[MildlyMilitary military demeanour.]]

While Kirk and Spock do menial jobs, Spock is able to [[BambooTechnology construct a rudimentary computer]] using electronic parts he has assembled. Kirk and Edith begin to fall in love. While Spock is scanning new stories from their time period, he discovers a terrible truth: Soon after he entered the portal and arrived on Earth, [=McCoy=] saved Keeler from dying in an auto accident. Since she did not die as intended, she later became [[SoapboxSadie a peace activist]] and successfully convinced FranklinDRoosevelt to keep America from entering UsefulNotes/WorldWarII until too late, [[GodwinsLawOfTimeTravel allowing the Nazis to win]] and preventing Starfleet from ever existing. Kirk and Spock realize that [[SadisticChoice in order to prevent this from happening, Edith Keeler must die.]]

Meanwhile, [=McCoy=] has been running loose in the city, still affected by the drugs. After an altercation with a homeless man who [[RecklessGunUsage steals his phaser and shoots himself with it]], he is found and taken in by Keeler, who believes he is merely drunk. As he recovers from the drug's effect, he befriends her, unbeknownst to Kirk and Spock.

The following night, Kirk takes Edith on a date to the movies -- the night of her accident. An offhand comment by Edith reveals to Kirk that she knows [=McCoy=]. When Kirk and Spock run into [=McCoy=] on the street, Edith walks into traffic to find out what's going on. Kirk instinctively moves to push her out of the way, but Spock insists he not interfere. When [=McCoy=] moves to save her, Kirk restrains him, and Edith is struck by a car and dies, returning history to its original timeline.

[=McCoy=] angrily demands to know why Kirk stopped him from saving Edith. Spock assures him that Kirk knew fully what he was doing. With the timeline restored, the three are able to return to the planet through the portal, where the ''Enterprise'' has reappeared. Scotty expresses surprise at [[YearInsideHourOutside the short time that's elapsed since they left.]] The Guardian offers to show the crew more fantastic journeys, but an emotionally shaken Kirk simply states "Let's get the hell out of here" and prepares to have the crew beamed back aboard.

Presently, IDW is publishing a comic book adaptation of Harlan Ellison's original script of this story.

!!Tropes
* AlwaysSaveTheGirl: Played with, since saving Edith would ''doom'' the world.
* AnimatedAdaptation: The [[WesternAnimation/StarTrekTheAnimatedSeries TAS]] episode "Yesteryear" is a sort of sequel to this episode.
* BambooTechnology: Spock has create a massive crude circuit array for his tricorder to display its recordings from the Guardian and he complains that he has to work with the 1930s equivalent tech resources of "bear skins and stone knives."
* BigApplesauce
* BittersweetEnding: Edith dies, but the future continues as normal.
* CrowningMomentOfAwesome: Considered the best episode from the Original Series ever made. coincidently the TAS sequel episode "Yesteryear" is considered the best animated episode and the only one Roddenberry considered making canon.
* CrowningMomentOfFunny: Kirk's attempt to explain Spock's ears to a patrolman.
-->'''Spock''': Perhaps the unfortunate accident I had as a child.\\
'''Kirk''': The unfortunate accident he had as a child. He caught his head in a mechanical... ({{Beat}} glances at Spock knowing how ridiculous this next part sounds) ...rice picker.
* DramaticShattering: A random vagrant is so frightened by Bones' appearance that he drops a glass bottle of milk.
* ExecutiveMeddling: The writer Creator/HarlanEllison described later on how his original teleplay - which required massive and expensive sets, had a drug dealing yeoman as the villain, additional characters for comic relief, and had ''Spock'' and not Kirk make the decision to let Edith get killed - got shredded. To be fair, depicting a drug culture went against Roddenberry's Utopian ideals of Starfleet, and Kirk being TheKirk had to make the tough decisions.
** The original teleplay by Ellison went on to win the Writers Guild of America award for Best Script, while the revised script - rewritten by the two Genes (Coon and [[GeneRoddenberry Roddenberry]]), story consultant Steven W. Carabatsos and D.C. Fontana - won the HugoAward for Best Dramatic Presentation.
* FamilyUnfriendlyAesop: TheReveal that Edith ''has'' to be killed, else her pacifist movement will keep America out of WorldWarII and result in the Nazis developing atomic power first and winning, ultimately sums up as one of these. "Pacifism is an ideal to aspire to, but reality is more cynical, and sometimes people must be prepared to fight." It's not necessarily a ''bad'' aesop, but it's certainly more cynical than you'd expect of a 60s show, and in rather stark contrast to the pretty strong "Pacifism = Good" message sent by earlier episodes.
* FanficFuel: The Guardian has appeared in dozens of Star Trek novels.
* FishOutOfTemporalWater
* ForWantOfANail
* GodwinsLawOfTimeTravel
* HomeVersionSoundtrackReplacement: Accidentally averted. The [=DVDs=] were originally going to have "Goodnight, Sweetheart" replaced by generic music for monetary reasons. Then the [=DVDs=] were made with the song still in so Creator/{{Paramount}} paid the money.
* InformedAttribute: For a ''Guardian of Forever'', he certainly doesn't do anything to stop a drug-addled crazy man run into the past and screw with human history, the sort of thing a ''Guardian'' would be expected to prevent.
* KillTheCutie
* {{Leitmotif}}: "Goodnight, Sweetheart" is ''their'' song.
* MissedHimByThatMuch: [=McCoy=] is led out of the soup kitchen just as Spock shows up to serve.
* [[NecessaryFail Necessary Tragedy]]
* NotThatKindOfDoctor: Inverted when Bones tells Edith [[ImADoctorNotAPlaceholder "I'm a surgeon not a psychiatrist."]]
* PrecisionFStrike: "Let's get the hell out of here." The effect is obviously lost for modern viewers, but "hell" was pretty shocking for 1960s television.
* RecycledSet: 1930s UsefulNotes/NewYorkCity sure looks a lot like Mayberry from ''Series/TheAndyGriffithShow'' (Kirk and Edith even walk past "Floyd's Barber Shop"). You can also see Mayberry in the episode "[[{{Recap/StarTrekS1E8Miri}} Miri]]".
* SaveThisPersonSaveTheWorld: Inverted.
* SequelHook: The Guardian's final words definitely give the impression that the writing staff intended to make further historical stories. Unfortunately, it never happened.
* SetRightWhatOnceWentWrong
* ShootTheShaggyDog
* StatusQuoIsGod: Neither Spock nor Kirk suggests the possibility of taking the forward thinking Edith Keeler back to the future with them instead of letting her get killed 'again'.
** Perhaps this is what the "Guardian" is guarding against.
* TimeTravelRomance
* WhamLine: "Edith Keeler must die."
* WhatTheHellHero: Bones, after Kirk restrains him from saving Edith.
* YouCantFightFate
----
''"Many such journeys are possible. Let me be your gateway."''
----