[[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/StarTrekTheOriginalSeries\\
Episode: Season 1, Episode 28\\
Title: The City On the Edge of Forever\\
Previous: The Alternative Factor\\
Next: Operation: Annihilate!\\
Recapper: {{Tropers/Deckard}}]

->''"As I'm watching the episodes for reference just before drawing each strip, I take notes on ridiculous stuff that I can make fun of in the comic. Things that pull me out of the story and make me think, "That makes no sense. I can make a gag about this bit." For most episodes I have anywhere between 10 lines and half a page of notes. When this episode ended, I had written ''nothing''."''
-->-- '''David Morgan-Mar''', creator of ''Webcomic/PlanetOfHats''


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 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.]] It also easily steals Spock's CulturalPosturing crown.

The conversation with the Guardian is interrupted when [=McCoy=] runs through the archway and disappears. Moments later, Uhura reports a loss of contact with the ''Enterprise'', and 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, which he uses to analyze his tricorder's recording of the historical scenes shown in the archway. Kirk and Edith begin to fall in love. Spock 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 UsefulNotes/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=] is shocked and furious, and demands to know why Kirk stopped him from saving Edith. Kirk is too heartbroken to say a word, and Spock gently tells Bones that "he knows". 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: Averted; Kirk chooses to kill Edith rather than let Hitler win WWII.
* AmericaSavesTheDay: Implied that this happened in WorldWarTwo, since America staying out of the war in Europe apparently allows Germany to defeat both Britain and Russia.
* BambooTechnology: Spock has to 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 "stone knives and bear skins." Of course, when Kirk drily remarks that it would be an extremely complex problem in logic, and that perhaps he expects too much of Spock sometimes, the science officer is quick to take up the challenge.
* BigApplesauce: Of all the places on Earth to which Bones (and later Kirk and Spock) could travel, he happens to choose New York City.
* BittersweetEnding: Edith dies, but the future continues as normal.
* CulturalPosturing: For once, Spock ends up on the receiving end of a conversation about how superior and advanced the speaker's culture is compared to the listener's. After Spock admits to Kirk that the mysterious archway which has been causing the time disturbances operates by no science he understands, the archway itself enters the conversation:
-->'''Kirk:''' Then what is it?\\
'''Guardian:''' A question. Since before your sun burned hot in space and before your race was born, I have awaited a question.\\
'''Kirk:''' What are you?\\
'''Guardian:''' I am the Guardian of Forever.\\
'''Kirk:''' Are you machine, or being?\\
'''Guardian:''' I am both... and neither. I am my own beginning, my own ending.\\
'''Spock:''' I see no reason for answers to be couched in riddles.\\
'''Guardian:''' I answer as simply as your level of understanding makes possible.\\
'''Spock:''' A time portal, Captain. A gateway to other times and dimensions, if I'm correct.\\
'''Guardian:''' As correct as possible for you. Your science knowledge is obviously primitive.\\
'''Spock:''' ''(FascinatingEyebrow)'' Really.\\
'''Kirk:''' ''(enjoying every minute of this)'' Annoyed, Spock?
* CutHimselfShaving: Kirk stumbles for an response when a suspicious cop notices Spock's pointed ears. Finally, after Spock suggests "the unfortunate accident I had as a child", he [[BlatantLies explains]] that Spock caught his head in a mechanical rice-picker.
* DramaticShattering: A random vagrant is so frightened by Bones' appearance that he drops a glass bottle of milk.
* ExplosiveInstrumentation: At the beginning of the episode, leading to Bones breaking out the cordrazine.
* FishOutOfTemporalWater: When they first arrive in New York in 1930, Kirk and Spock stand out like sore thumbs because of their Starfleet uniforms and Spock's Vulcan ears. Even after they are able to "borrow" clothes (and a woolly hat to hide Spock's ears), their ideals and behaviour mark them as strangers to the era, which does not escape Edith's notice.
* {{Foreshadowing}}: Almost the first thing to happen to Kirk and Spock when they arrive in the past is that they're nearly run over by a car.
* ForWantOfANail: Spock explains to Kirk that because Edith Keeler was not hit by a car and killed in 1930, she became the leader of a pacifist movement that delayed American entry into World War II for so long that the Nazis developed the atomic bomb first, and neither Starfleet nor the ''Enterprise'' ever existed.
* GodwinsLawOfTimeTravel: To quote Spock in David Morgan-Mar's treatment of this episode in ''Webcomic/PlanetOfHats'', "It's the First Law of Time Travel. [...] Time travel: ergo, Hitler." Bones going back to 1930 and preventing Edith Keeler's death causes the Nazis to win World War II.
* 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. Maybe 'Watcher' would have been more accurate to call 'him', seeing as he's a gateway who does his job, which doesn't include changes to the timeline (by it anyway). Website/SFDebris had an excellent go at this:
-->'''Chuck!Spock:''' Perhaps your new name could be something like "Butterfingers on the Edge of [[Series/FamilyMatters Whoopsie, Did I Do That?]]"\\
'''Chuck!Guardian''': I've '''succeeded'''! Just in a way [[SufficientlyAdvancedAliens far beyond your comprehension!]]\\
'''Chuck!Spock''': Yeah, that's not working anymore.\\
'''Chuck!Guardian:''' ...Shit.
* KillTheCutie: Edith Keeler devotes her life to helping the many poor and hungry of the Great Depression, and is convinced that humanity can achieve great things if they could only set aside their petty squabbles. Kirk is fascinated by her altruism and idealism and falls in love with her. And then Spock tells him that she must die if the timeline is to be restored.
* {{Leitmotif}}: "Goodnight, Sweetheart" is ''their'' song.
* MadScientistLaboratory: Spock's primitive computer workshop is a small-scale version of this, including an entirely gratuitous Jacob's Ladder.
* MissedHimByThatMuch: [=McCoy=] is led out of the soup kitchen just as Spock shows up to serve.
* TheNeedsOfTheMany: Kirk falls in love with Edith Keeler, partly because she has the same ideals upon which Starfleet would later be founded. But if he allows her to live, millions will die who did not die before, and Starfleet will never exist. He is forced to let her die to restore the timeline.
* NotThatKindOfDoctor: Inverted when, upon hearing that Edith has a friend "who talks about Earth in the same way you do" and offers to introduce him, Bones tells her, [[ImADoctorNotAPlaceholder "I'm a surgeon, not a psychiatrist."]]
* NotableOriginalMusic: Although this is the only episode to use music not specifically composed for the series, the musical cues featured in the episode are unusual for a different reason. Because the partial score composed for the episode incorporates cues from the copyrighted "Goodnight, Sweetheart", and because this episode aired so late in the first season, ''and'' because new recordings of music were conducted for each season (under union rules), ''all'' of the music composed for this episode is heard ''only'' in this episode - a vanishingly rare case indeed for a show which quite famously reused the same dramatic cues in dozens of episodes.
* PortalToThePast: The Guardian of Forever can not only display recordings of events at any time in Earth's past, but also allow the interested explorer to travel back to those times.
* 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 (contrast Kirk's slightly awkward line "Go to the Devil" from "Day of the Dove"), and they had to fight the network watchdogs to keep it in.
* PsychicPowers: The Guardian of Forever remains cryptic about its true nature (to Kirk's question "Are you machine, or being?", the Guardian answers, "I am both - and neither."), but it can communicate with the ''Enterprise'' landing party despite having no mouth or ears.
* RecklessGunUsage: After the still heavily-drugged Bones passes out in the middle of a paranoid rant to an alarmed bum, the bum searches his pockets for money or valuables and finds his phaser. He inspects the strange device and presses a button on it - while pointing it at himself. He is promptly disintegrated.
* ResetButton: According to the Guardian, if they were successful in restoring the timeline, "It will be as though none of you had gone". Then, this would indicate that the bum who accidentally killed himself with [=McCoy's=] phaser is restored to life. And from Edith's point of view, she never met any of them before she died. However, Kirk still remembers.
* RuinsForRuinsSake: The planet inhabited by the Guardian of Forever is covered by ruined stone columns. What they are doing there is never explained.[[note]] The use of this trope is accidental; the script decribes the planet as being covered in ancient ''runes''.[[/note]]
* SaveThisPersonSaveTheWorld: Inverted; in this case, it's ''Kill'' This Person, Save the World. If Edith Keeler lives, the Nazis win UsefulNotes/WorldWarII, and Starfleet is never founded. If she dies, history continues as normal.
* SequelHook: The Guardian's final words definitely give the impression that the writing staff intended to make further historical stories. Unfortunately, it never happened - at least in this series. It gets a proper sequel in the animated series episode [[Recap/StarTrekTheAnimatedSeriesS1E2Yesteryear "Yesteryear"]].
* SetRightWhatOnceWentWrong: Inverted when Bones goes back to the past and prevents Edith Keeler's death, thereby preventing Starfleet from ever existing, then played straight when Kirk and Spock have to follow him and prevent him from preventing Edith Keeler's death.
* ShootTheShaggyDog: Much of the episode focuses on Kirk's growing romantic attraction to Edith. But at the end of the episode, he is forced to set his feelings for her aside and let her be hit by a car and killed in order for the timeline to be restored.
* SoapboxSadie: Edith Keeler subjects the regulars at the 21st Street Mission to numerous speeches about the greatness of which humanity is capable, and the notion that one day, they will harness atomic energy, travel into space, cure disease, and feed the hungry. Most of the poor and hungry diners see her speeches as the price they have to pay for a hot meal at the mission. Kirk, however, is fascinated by Keeler's ideals, which are almost identical to those on which the Federation and Starfleet would be founded three centuries later.
* 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: Kirk and Spock travel back in time by several centuries, where Kirk falls in love with "temporal local" Edith Keeler.
* WhamLine: "Edith Keeler must die."
* WhatTheHellHero: Bones, after Kirk restrains him from saving Edith.
* YearInsideHourOutside: When Kirk and Spock re-emerge from the Guardian's portal after having spent the better part of a week in 1930, Scotty asks, "What happened, sir? You only left a moment ago."
----
''"Many such journeys are possible. Let me be your gateway."''
----