Star Trek: Wolf in the Fold

On stardate 3614.9, the starship USS Enterprise arrives at Argellius II, a planet with a Middle-Eastern cultural influence primarily dedicated to peaceful hedonism. Ship's Captain James T. Kirk, chief medical officer Dr. Leonard McCoy, and chief engineer Montgomery Scott, beam down for some shore leave.
Scotty is attracted to a belly dancer named Kara and invites her to walk down a fog-shrouded alley. Shortly thereafter, Kara is stabbed to death and Scotty, in shock, is holding the murder weapon. His are the only fingerprints on the knife, but he claims to have no memory of the event. Dr. McCoy diagnoses Scotty with a mild concussion, caused by a female crew member aboard the Enterprise. McCoy has already concluded that Scotty has developed a resentment towards women, and that distrust could manifest itself in murder.
Hengist, the Chief Administrator of Argellius II, demands that Scotty be locked up suggesting he may murder again if left unsupervised. Prefect Jaris suggests that Kirk seek the advice of his wife Sybo who is an Argelian empath. Kirk agrees, but he wants Scotty monitored by a tricorder and orders Lt. Karen Tracy to beam down and administer the test. Kara's father mentions another suspect: Kara's former fiancé Morla, who, unlike most Argellians, is extremely jealous and fought with Kara. Morla is brought in for questioning but he claims he had nothing to do with the killing; he actually left the cafe where she danced in order to maintain his composure.
Lt. Tracy begins testing Scotty. Suddenly, screams ring out and the others find Tracy stabbed to death and Scotty once again in shock. Hengist believes that Scotty must be the killer, as there is no way into that room except through the room in which the others were setting up for Sybo's seance.
Jaris and his wife Sybo insist on continuing and Sybo falls into a deep trance. She senses a great evil and cries out several names: "Beratis", "Kesla", "Redjac", all names for an ancient entity that has intense hatred for the life of women. The room goes black, Sybo screams and when the lights come Sybo is fatally stabbed, lying in Scotty's arms.
Kirk has everyone beamed back to the Enterprise so that the computers can analyze Mr. Scott's testimony of innocence. The computer confirms that both Scotty and Morla know nothing about the murders. Scotty insists however, that he felt the presence of a cold, evil creature during Sybo's meditation.
The computer confirms such a creature could exist, but would be incorporeal, existing as formless electromagnetic impulses. The computer cites the creatures of Alpha Carina V who subsist on the emotion of love. It also suggests that the creature may take a solid form at will, as the miletus cloud creature of Alpha Madoris that can change from gaseous to solid forms. Spock believes this "Redjac" to be an entity that gains nourishment from the fear of its victims.
Kirk decides to run the names spoken by Sybo through the computer. The machine returns information that Beratis (of Rigel IV), and Kesla (of Deneb II), are names given to the unresolved identities of serial killers on those worlds. It also identifies Redjac as "Red Jack", the name of the elusive 19th Century Earth serial killer Jack the Ripper.
The computer goes on to say that Redjac may have been responsible for other killings, both on Earth (seven women in Shanghai, China, Earth, in 1932; five similar murders in Kiev, U.S.S.R., Earth, in 1974) and other planets; there were eight murders of women in the Martian Colonies in 2105 and ten murders of women in Heliopolis, Alpha Eridani II in 2156. Spock notes that all these locations lie sequentially between Argellius and Earth.
The computer adds that the Beratis killings took place on Rigel IV less than one solar year ago, and that the knife used in the killings matches knives crafted by the indigenous Hill People of Rigel IV's Argus River region. This implicates Mr. Hengist, who is from Rigel IV. Mr. Hengist becomes nervous and denies the evidence points to him. He flees the room, but Captain Kirk subdues him. Dr. McCoy discovers the man is dead.
Suddenly, the ship's computer system goes haywire and Hengist's distorted laughter is heard throughout the ship. He makes threats that they can never catch him and that they will all die. Spock believes the Redjac entity has taken over the ship through its computer and that the entity will become stronger by feeding off the crew's growing fear.
Dr. McCoy tranquilises everyone on the ship and Spock neutralizes Redjac's control of the ship's computer by ordering it to compute to the last digit the value of π. As their fears fade, Redjac weakens and must return to Hengist's body. Kirk has him rushed to the transporter room. He beams Hengist, and Redjac with him, out into the depths of space.