[[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.'"'']]

->''"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 (credited to Creator/HarlanEllison[[note]]who wrote the story but not the teleplay - see the Trivia tab for all the gory details[[/note]]), 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 -- the night of her accident -- Kirk takes Edith on a date to the movies. 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 course.

[=McCoy=] is shocked and furious, demanding to know why Kirk stopped him from saving Edith and if he knows what he's done. 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.

In 2015, IDW published a comic book adaptation of Harlan Ellison's original script of this story.

* AlwaysSaveTheGirl: Averted; Kirk chooses to kill Edith rather than let Hitler win WWII.
* AmericaSavesTheDay: Implied that this happened in UsefulNotes/WorldWarII, since America staying out of the war in Europe apparently allows Germany to defeat both Britain and Russia. [[JustifiedTrope Somewhat justified as the Nazis develop nuclear weapons as a result and that's not good for anybody.]]
* AmericaWonWorldWarII: Due to pacifist movement USA did not enter WWII, and Hitler won precisely because of it, causing humanity to be enslaved and never reaching the stars.
* ArtisticLicenseHistory: Edith's fate is pinned on the reveal that neither Kirk nor Bones know who Creator/ClarkGable is. The episode takes place in 1930, so in fact Edith shouldn't have known who he was, either - he was just a bit player in 1930; he didn't become a star for another two years. Reportedly at one point the script used the name of a lesser-known (to 1960s audiences) actor named Richard Dix, but by the time the episode was filmed it was decided to use the better-known Gable, despite the anachronism.
* 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: This episode sets the bar for [[TearJerker tragic]] ''Star Trek'' endings. Edith dies, leaving Kirk a broken man, but the future continues as normal.
* ClotheslineStealing: Kirk and Spock take clothes to blend in in 1930s America. They get noticed by a police officer.
* CoverVersion: The 1931 popular song "Goodnight, Sweetheart" (written by Ray Noble, Jimmy Campbell, and Reg Connelly) is performed by the series orchestra (in an arrangement by the episode's composer, Fred Steiner), though it is shown to be [[SourceMusic playing on the radio in the scene]] (marking a rare use of diegetic music for the series). Accordingly the arrangement is very much in the style of popular music in the 1930s, with a brief vocal section (provided by an unknown and uncredited session vocalist) followed by a lengthy instrumental section.
* 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:''' [[SuddenlyVoiced 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.
* FaeriesDontBelieveInHumansEither: [=McCoy's=] response to Edith Keeler's understandably skeptical reaction to his drug-induced delirious mumblings about who he is: "That's all right. I don't believe in you either." (In fact, he initially dismisses his whole situation as some kind of Cordrazine-induced hallucination.)
* 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.
* GaussianGirl: Edith Keeler is exceptionally blurry in all close-ups, even by ''Star Trek'' standards.
* 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.
* HeroicBSOD: Kirk ends the episode in one of these.
* 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.
* PopCulturalOsmosisFailure: Bones is well-aware of what movies are, but hasn't a clue who Clark Gable is.
* 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.
* RealityEnsues: Kirk and Spock travel back in time to Depression-era New York in order to avert a disastrous event that changed history, but they don't know what it is. Fortunately for them, the information is stored on their tricorders. Their tricorders are damaged and Spock works to fix them, but he quickly finds it almost impossible. No matter how smart Spock is, the tricorder is centuries ahead of the most cutting-edge technology available at the time, and he's been trained to use highly advanced tools in a time where getting a pound of pure gold or platinum for your amateur electronics project is no simple matter - he compares it to working with "stone knives and bearskins". He's reduced to working with consumer-grade electrical goods such as lightbulbs and radio sets, and can only get a few seconds of functionality out of the tricorder after days of work. Also, in order to buy those materials he and Kirk need to work menial odd jobs and live in a homeless shelter, and in order to fit in they steal clothes off a clothesline... where they are promptly confronted by a police officer.
* 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 describes 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.
* SlasherSmile: Bones has briefly one [[https://www.youtube.com/watch?v=-ctS1rewbUY]].
* 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. There's just the small problem of another couple of World Wars in between...
* 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.
* StockFootage: Tthe Guardian of Forever shows history via stock footage from old films.
* TheStoryThatNeverWas: The episode ends with this trope {{implied|trope}}, the crew find themselves on Earth in the 30's after [=McCoy=] ends up accidentally drugged and falls through a mysterious portal, which causes the Enterprise to disappear. While they look for him, they meet a beautiful woman who they eventually realise became a peace activist who delayed America's entry into WWII just long enough to lead to a BadFuture. Kirk is forced to grab [=McCoy=] when he moves to prevent her from being run over while crossing the road (as presumably happened with Bones present, but not Kirk).
* SufficientlyAdvancedAlien: Either the Guardian itself, or whoever built it.
* TimeTravelRomance: Kirk and Spock travel back in time by several centuries, where Kirk falls in love with "temporal local" Edith Keeler.
* UnwittingInstigatorOfDoom: Both [=McCoy=] and 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."''