Stardate 3219.4: Kirk, Spock, and McCoy are in the shuttlecraft Galileo taking Commissioner Nancy Hedford back to the Enterprise for treatment against Securo's Disease, which will prove fatal if she is not treated in time. They pick up an ionized energy cloud approaching them at warp speed. It intercepts the shuttlecraft, shuts down its systems, and pulls it off-course.
The shuttlecraft is forced down on a small planetoid and Kirk and the others emerge. They can't account for the complete engine shutdown and McCoy detects similar ionized energy readings on the planet. They are then greeted by a human wearing a space pilot's uniform. He is happy to see them but warns that he's been stranded on the planetoid for quite a while and their engines won't work. He avoids answering any questions about the energy field that brought them there, and invites them over to his shelter, while they wonder where they've seen him before.
At the shelter, Helford's temperature starts to go up and she's unhappy with the situation as she was on her way to stop a war. Spock spots the same energy field, briefly hovering over the planet's surface before disappearing. Cochrane claims it's a mirage but when Kirk insists on an explanation, Cochrane explains that it is an entity that he calls the Companion. He says it brought him here when he was traveling in space and dying of old age. The Companion rejuvenated him and kept him there. When Cochrane gives his name as Zefram, Kirk recognizes him as the discoverer of the space warp… and he died 150 years ago.
Cochrane was famous throughout the Federation before he disappeared at the age of 87. Cochrane explains that he went into space to die, and the Companion brought them to the planetoid to keep him company. He tried to explain to it that he was lonely so it brought others rather than released him. Hedford breaks down and Kirk orders Spock to find a weapon to use against the Companion. Cochrane is glad to be gone after decades of immortal boredom and loneliness and offers his help.
Spock is working on the shuttlecraft when the Companion appears before him. It reacts to his touch by shocking him unconscious then short-circuiting the shuttlecraft wiring.
McCoy is tending to Hedford and Kirk wonders if the Companion can cure her. Cochrane agrees to establish his usual non-verbal communication with the Companion and it approaches him. McCoy believes it's more of a symbiosis, a kind of joining. Kirk wonders if it might be love. Cochrane confirms that the Companion can do nothing for Hedford, while McCoy finds Spock at the shuttlecraft. He concludes the Companion is primarily electricity and they might find a way to short it out. Spock rigs an electrical scrambling device but Cochrane is concerned it might harm the Companion. Kirk overrides his objections and has Cochrane lure the creature ear the shelter. They activate the device and the Companion shocks Cochrane then advances on Kirk and Spock, choking them. Cochrane wakes up and reestablishes contact, drawing it back to him.
McCoy suggests Kirk takes a more diplomatic approach and the captain has Spock rewire their universal translator from the shuttlecraft. McCoy warns that Hedford's condition is worsening.
Scotty is conducting a search for the Galileo after it fails to meet their rendezvous, and tries to follow along their last known course.
Once Spock's work is complete, Cochrane calls the Companion again and they establish communication. Cochrane is surprised to hear that the Companion is a female and Kirk and the others figure it is Cochrane's lover. They try to convince her that it's wrong for her to imprison them and doesn't seem to understand that Hedford is dying. It also doesn't understand the concept of the humans dying when imprisoned and fades away, unconvinced.
Cochrane is surprised and disgusted once he realizes the nature of the Companion's feelings toward him. He storms out while Hedford, overhearing, admits that while Cochrane is rejecting love, she's never had it.
The Enterprise arrives in the planetoid's asteroid belt and begin a scan of those with a breathable atmosphere.
Cochrane summons the Companion again so Kirk can talk to it, appealing to its feelings of love. He tries to convince her that she is condemning him to an unbearable existence, and insists that it can't unite her in its current form, or communicate or love him on a human level. The Companion wonders if it were human, then there could be love, then disappears. They don't seem to have accomplished anything… until Commissioner Hedford emerges from the shelter, completely recovered… and speaking in the voice of the Companion.
The Companion explains that her and Hedford are now as one. She goes to Cochrane, who shies away from her. The Companion feels loneliness for the first time, and tells Kirk and the others their shuttlecraft is now functional. She then explains that she is no longer immortal and will age and die as a normal human. Cochrane reconsiders and goes for a walk with her.
Kirk makes contact with the Enterprise which heads for the planetoid, while the Companion explains that it can't leave the place for more then a few days. Cochrane insists on staying with the Companion, as she took care of him for the last 150 years. Spock notes that they will both age, but Cochrane is willing to stay with the female that he loves. Kirk promises not to tell anyone of Cochrane's existence and they head back to the shuttlecraft.