"The City on the Edge of Forever" is renowned as the best episode of Star Trek: The Original Series, but the version that aired is different from what was envisioned by its writer, Harlan Ellison. The cantankerous Ellison was one of the greatest science fiction authors, and he was an early recruit by Star Trek creator Gene Roddenberry to give his NBC sci-fi series legitimacy. However, Ellison bristled under the realities of TV production; although he is given sole writing credit for the episode, Ellison long complained that his version of "The City on the Edge of Forever" was "butchered" by Roddenberry and his writing team, who removed many of Ellison's concepts like the 9-foot-tall Guardians of Forever while adding (and then excising) elements like space pirates.

The version of "The City on the Edge of Forever" that aired preserves the general sweep of Ellison's original story: Captain Kirk (William Shatner) and Mr. Spock (Leonard Nimoy) time-travel to the 1930s to prevent one of the Starship Enterprise's crewmembers from altering history. Kirk falls in love with Sister Edith Keeler (Joan Collins), who has a utopian view of the future. Kirk is dismayed to learn that Keeler is the vergence in time and he must allow her to die in order for history to be set right. In the aired version of the episode, the culprit who threatens time is Dr. Leonard McCoy (DeForest Kelley), who accidentally injects himself with a drug called cordruzine, which drives him mad. McCoy beams down to a planet at the center of a time displacement and leaps through a time portal called the Guardian of Forever into the 1930s. When McCoy changed history, it meant the Enterprise never existed so it vanished, leaving Scotty (James Doohan) and Uhura (Nichelle Nichols) stranded on the planet until Kirk and Spock returned with McCoy.

Related: Star Trek's Original Movie Plans Would Have Been Better Than The Motion Picture

Ellison raged at the changes that Roddenberry, D.C. Fontana, John D.F. Black, and Steve Carbatsos made during a series of rewrites. Roddenberry balked at Ellison's original villain, Lieutenant Beckwith, who dealt a narcotic called the Jewels of Sound to his fellow shipmates on the Enterprise. In Ellison's version, Beckwith was to be executed by firing squad on the planet before he escaped through the time machine; Roddenberry refused the idea of a drug-dealing Starfleet Officer aboard the Enterprise. The 9-f0ot-tall Guardians of Forever Ellison envisioned were replaced with the episode's doughnut-shaped portal for budgetary reasons, which Ellison hated.

Harlan Ellison at LA Press Club in 1986

Ellison was also incensed that McCoy became the time-distorting culprit by accidentally injecting himself, which he thought made the Enterprise's Chief Medical Officer come off as a fool. Another casualty of rewrites was Trooper, a tragic World War I veteran who fought at Verdun Kirk and Spock met in the past. Finally, Ellison intended for Spock to be the one to let Edith Keeler die because Kirk couldn't bring himself to sacrifice the woman he loves. In the aired episode, Kirk stops McCoy from saving Edith - an ending Roddenberry preferred since it makes Kirk, the hero of the show, the one who has to make the impossible choice.

Compounding Ellison's grievance against Star Trek was the fact that Roddenberry spent years giving lectures where he repeatedly told his version of events, blaming Ellison for the episode running over budget, introducing space pirates into the episode, which was a change Roddenberry himself added and then cut, and that Ellison had "Scotty dealing drugs," which never happened in any version of the episode. In 1995, Ellison released a book containing his original script for "The City on the Edge of Forever," continuing his beef with Star Trek years after Roddenberry died. Ellison's "The City on the Edge of Forever" was also adapted into a graphic novel.

The aired episode of "The City on the Edge of Forever" remains a riveting tale with a heartbreaking ethical problem at its core. However, Harlan Ellison's original concepts, such as his idea of the Jewels of Sound and that sound can be a narcotic, are certainly provocative. His villain, Beckwith, could even have emerged as one of the great Star Trek antagonists, like Khan (Ricardo Montalban), and Harlan envisioned a sweeping epic that would have been unforgettable if Star Trek had the budget to film them. Ultimately, Ellison's "The City on the Edge of Forever" was just too grand for Star Trek at the time, but it's a testament to how powerful Ellison's ideas are that the episode that aired, though not what Ellison intended, remains the best Star Trek episode.

Next: Star Trek's Unlikely I Love Lucy Connection