Stardate 4657.5: The Enterprise investigates a distress signal and finds a peaceful uninhabited planet with indications of metal debris. Kirk, McCoy, Spock, Shea, and Yeoman Thompson beam down to the planet and are confronted by two human-looking individuals. They demand that Kirk surrender the ship and when he refuses, they use devices on their belts to immobilize the entire landing party. The leader identifies himself as Rojan and says they will be leaving the galaxy soon, and humans must prepare for the end of their existence as they know it.
Rojan and the female Kelinda take the landing party's equipment and then unparalyzes them, and says they will modify the Enterprise to take them to Andromeda. They are the Kelvans, and high radiation levels in their own galaxy will make it uninhabitable. Rojan is part of several expeditions sent to find new galaxies to colonize. Rojan's other three people beam up to the ship and immobilize the crew, then take control of the ship. Rojan informs Kirk they can modify the ship to make the trip to Andromeda in only 300 years: they're ship was destroyed coming passing through the galactic barrier. Kirk tries to start negotiations but Rojan insists they are conquerors. He puts the landing party in a cave to use them as hostages to force the rest of the ship to follow orders.
In confinement, Spock notes that the Kelvans have perfect human bodies. They decide to try and find the Kelvans' central projector and have Spock try and establish a mental probe with Kelinda. Spock is shocked but Kelinda investigates and Kirk knocks her out and takes her belt device. However, the other Kelvans immobilize Kirk and take the device, and then convert Shea and Thompson into compressed blocks of inert matter. Rojan crushes the block representing Thompson then restores Shea, as an object lesson in the price of disobedience.
Back in the cave, Spock explains he was thrown away by powerful and strange mental images, which revealed the Kelvans as having a hundred tentacles and enough brainpower to control them all independently. They conclude that the Kelvans have taken human form to better use the human-oriented ship. Kirk decides they need to use McCoy's medical equipment to jam the Kelvans' generator, and has Spock feign illness by entering into a self-induced coma to fake an illness get him up to Sickbay. The ploy works and McCoy takes Spock to Sickbay where the Vulcan revives. McCoy gives him a vitamin injection while one of the Kelvans, Tomar, looks on.
Rojan and Kelinda meet with Kirk and try to convince him that resistance is futile. They then board the Enterprise and head for the galactic barrier at Warp 11. Kirk goes to Sickbay to check on Spock. Spock, McCoy, and Scotty have located the generator in Engineering but can't penetrate its casing. Spock and Scotty suggest they blow the ship up and have rigged the anti-matter in the nacelles to detonate, but Kirk is reluctant to do so.
They head for the barrier and enter it, while Scotty waits for the command to self-destruct. Kirk signals him to hold his position and they penetrate the barrier after a considerable shock. Rojan orders his people to begin the "neutralization process," to reduce the threat from the crew and the drain on the food processors. Rojan eliminates all of the non-essential bridge personnel, converting them into blocks. Kirk later meets with McCoy, Scotty, and Spock and determines they are the only four considered essential. Tomar comes in to ask them why they eat food and Kirk has McCoy demonstrate the concept of "eating." Tomar enjoys the taste and Kirk and the others observe his reaction. Spock concludes that the Kelvans have given up distracting senses and emotions. However, now that they are in human form they are subject to human feelings. They decide to over stimulate the Kelvans' sensors to distract them and get the belt devices.
Scotty goes to work by offering Tomar some Saurian brandy. McCoy examines Hanar and says he needs vitamin injections. Kirk goes to see Kelinda and apologizes for hitting her and then starts seducing her by kissing her bruise and then her lips. She analyzes it emotionlessly for a bit… then tries it on him. Rojan comes in and interrupts them, and after Kirk leaves she demonstrates for an umimpressed Rojan.
Spock plays chess with Rojan and provokes him into jealousy by explaining what kisses usually mean… and then beating him at chess. Scotty and Tomar are getting progressively more drunk in the engineer's quarters. Rojan goes to see Kelinda and insist that she avoid Kirk, but she refuses. Scotty finally breaks out the whiskey. Meanwhile, McCoy reports that he's been injecting formazine to Hanar, which should drive him up the walls. Kelinda asks to talk to Kirk and flirts with him. On the bridge, Hanar snaps at Rojan and is confined to his quarters. Spock reports to the bridge and notes that Kelinda is with Kirk, and Rojan storms off to confront them.
Scotty finally gets Tomar passed out unconscious and tries to stagger out of his quarters to report his success… and collapses himself.
Rojan attacks Kirk and the two struggle as Kelinda looks on. Kirk points out that Rojan is furious with rage, letting his newfound feelings overwhelm him. The captain then convinces Rojan they would accept his people as friends and allies, and Rojan agrees. A robot ship will be sent to Kelva to notify them of the offer. Kelinda kisses Rojan and they decide to head back to the original planet they were found on to establish a colony.