The U.S.S. Enterprise is sent to investigate the destruction of the Malurian system and its four billion inhabitants. When it arrives at the coordinates, the starship itself is threatened by a space going, self-contained computer/probe calling itself Nomad. When Kirk identifies himself by name, Nomad mistakes him for "The Kirk," and thinks him to be his creator.
Nomad is beamed aboard the U.S.S. Enterprise and promptly erases Uhura's memory and kills Scotty, claiming that neither life form was perfect. At Kirk's demand Nomad repairs "the unit Scott," bringing him back to life.
Spock attempts a Vulcan mind meld with Nomad and learns that it was created on Earth in the twenty-first century by scientist Jackson Roykirk. Nomad's program was to seek out new life and report back to Earth. Damaged in space by a meteor, Nomad drifted until it found Tan Ru, an alien probe designed to sterilize soil. Using their self-repair systems, the two probes combined themselves into one. Nomad's programming was damaged and by joining with Tan Ru's now believes its mission is to seek out life and destroy anything that it does not believe perfect.
Kirk convinces Nomad that it had mistaken him, Captain James T. Kirk, for Nomad's creator, Jackson Roykirk, thus making Nomad imperfect and a candidate for "sterilization." A confused Nomad begins to self-destruct, exploding just after Kirk beams the changeling into space. Kirk checks on Uhura's progress after the attack by Nomad. McCoy informs him that her brain is undamaged and she must simply "relearn" what the probe erased.