In answering a medical emergency at an archaeological expedition, Kirk confronts the deep hatred of an old love, Janice Lester, who supposedly lies severely ill from celebium radiation. In payment for jilting her back at Starfleet Academy, Dr. Lester arranges for an alien machine to swap her consciousness with that of the captain and takes command of the Enterprise. Once aboard, Kirk (in Lester's body) tries to convince Spock that he is trapped in her body. As a result, Janice (in Kirk's body) conducts a court-marshal with the intent of executing Spock and Kirk (in Janice's body), and later McCoy and Scott, to keep her secret. The crew realize something is seriously wrong with their captain and, not wishing to incur an illegal death-penalty themselves, begin a passive resistance.