When “Star Trek” premiered in September of 1966, it instantly revolutionized science-fiction television. Begun by creator Gene Roddenberry as a sci-fi riff on popular shows at the time like “Wagon Train,” the series was the first non-anthology genre program aimed at adults, and quickly grew a following that went from cult status to full-blown phenomenon.

The show’s rise in popularity saw fans first saving it from cancellation and then being instrumental in Paramount choosing to continue the franchise as a motion picture series in 1979. The “Trek” brand soon came to be known not just for its core characters, but for its themes of optimism, scientific and technological progress, and social harmony, with the various crews of the starship Enterprise seeking out “new life and new civilizations” with the aims of study and education rather than conquest. Arriving at this pioneering approach wasn’t easy, as “Trek” famously had not one but two pilot episodes scripted and shot; they had different tones and cast members, yet both were unmistakably sci-fi, and the second pilot, “Where No Man Has Gone Before,” better established the show as being aimed at emulating pulp genre fiction of the time, with an emphasis on adventure as the TV executives insisted.

However, neither of those pilots were aired on September 8, 1966, the night “Star Trek” premiered on NBC. That episode was instead “The Man Trap,” a story about the Enterprise crew encountering a shapeshifting alien that murders its victims by depleting their bodies of salt. The more humanitarian aspects of the show could already be seen—Captain Kirk (William Shatner) mourns the fact that the crew must eliminate the creature, who only kills to survive—but the fact remains that the episode is a prime example of ‘50s and ‘60s era sci-fi creature feature horror. The episode was written by George Clayton Johnson, who had a highly successful TV career writing for Rod Serling’s “The Twilight Zone” just a few years earlier, and was still clearly in that mode when “Star Trek” came calling. With this unusual yet auspicious premiere episode, placing first in the ratings in its timeslot, “Star Trek” began a run that would see it intersect with and utilize horror more often than not, proving that the series could explore the darker corners of the universe as well as the more enlightened ones.

In a way, this was by design, as Roddenberry and his story editors, John D.F. Black and Dorothy Fontana, sought to hire as many sci-fi, horror, and genre writers as they could to work on the initial seasons of the show, in the hopes that finding people already familiar with genre (since the show’s concept was so new) would be an easy transition. “Where No Man Has Gone Before” was written by Samuel Peeples, a veteran of many Western novels and TV shows, and Peeples’ concept of a crew member being taken over by a mysterious Godlike psychic power at the edge of the galaxy is not only Lovecraftian in its overtones, but presages the group of cinematic psychic horror thrillers like The Power (1968), The Fury (1978) and Scanners (1981).

In addition to Johnson and Peeples, other established genre writers with a background in horror or genre writing were hired such as Richard Matheson, Harlan Ellison, Art Wallace, and Robert Bloch. Bloch, who had gained fame as the writer of the novel “Psycho” which Alfred Hitchcock adapted into a movie, and who would soon go on to be involved with several Amicus horror portmanteau films, wrote a trio of episodes for “Star Trek.” These episodes openly played with horror tropes, dealing with a mad scientist creating android duplicates (“What Are Little Girls Made Of?”), a Hammer/Universal horror pastiche set inside a “haunted” castle (“Catspaw”) and a story about Scotty (James Doohan) being framed for murder by the immortal disembodied spirit of one Jack the Ripper (“Wolf in the Fold”). With these writers and their episodes, “Star Trek” more than established its horror bonafides.

Some of the most fascinating (no pun intended) episodes of the show are the ones that, even more than being horror-adjacent, engage most directly with the genre. In addition to the Bloch triptych, the show dealt with an apocalyptic invasion of parasites (“Operation—Annihilate!”), a HAL 9000-esque rogue A.I. (“The Ultimate Computer”), alien-possessed super powered kids (“And the Children Shall Lead”) and lethal extraterrestrial creatures (“Devil in the Dark”) in ways that closely resemble the horror films of the time period. The episode “The Lights of Zetar,” despite its science-fiction premise, is for all intents and purposes a demon possession story. In the episode (co-written by Lamb Chop creator Shari Lewis, no less), a crewmember (Jan Shutan) is affected by a mysterious storm the Enterprise travels through, after which it is revealed that her body has been taken over by the non-corporeal remains of a dying alien race, who intend to use her to live on. The depiction of this by Shutan and director Herb Kenwith, with the actress making eerie expressions while Kenwith manipulates her voice to cause the character to make unnatural, sickly noises, is genuinely unsettling. Swap the sci-fi backstory for a religious mythology, and you have any one of the demon possession movies made in the 1970s, including The Exorcist (1973).

The episode can be seen as just one of the series’ many influences on genre filmmaking to come—even the celebrated “The Trouble With Tribbles” episode, which is very clearly a comedy, anticipates Joe Dante’s film about fuzzy little creatures overwhelming an unsuspecting group of people, Gremlins (1984), several decades in advance.

After three seasons, “Star Trek” was cancelled, and wouldn’t be revived for a decade, this time as a big-budget motion picture franchise. In the intervening years Roddenberry, as well as the legion of fans that the show gained, saw the franchise as less pulp genre adventure and more as a heady, positivity-based universe that became more interested in the exploration of various alien cultures than too many weird sci-fi/horror baddies. Still, there were vestiges of the original series’ penchant for horror to be found in the feature films; Star Trek: The Motion Picture (1979) was directed by Robert Wise, who brought an eerie approach reminiscent of his work in The Haunting (1963) to some scenes of V’Ger invading the Enterprise, and anyone who’s seen Star Trek II: The Wrath of Khan (1982) is surely traumatized by the ear-invading Ceti eels.

The spin-off/sequel shows dipped their toes into the horror world on occasion, with the techno-terror of the Borg being a particular highlight. Yet the franchise never delved further into classic horror than those handful of episodes of its original series, and while for us horror fans that’s a disappointment, we can hope that the continuing popularity of “Trek” might hold some surprises for the future—“Spock Vs. Dracula,” anyone?

Besides, at least one “Star Trek” character continues to inspire fear to this day in his own fashion: we all know where the filmmakers of Halloween found Michael Myers’ mask, after all.