After being scanned by an unknown alien spaceship, the Enterprise crew discover that their memories, along with those of the ship's computer, have been partially erased. Although they retain their practical knowledge and skills, none of the crew can remember who their crewmates are, and have forgotten their own identities. Mysteriously, during the scan, an additional crewmember, in an officer's uniform, with the rank of commander, has joined the group on the bridge.
The bridge crew attempts to gain control of the situation, and Worf—wearing his baldric— assumes because he is decorated that he is the captain of the ship, and assumes command. Data, with the memory files identifying who he is unavailable, and based on where he was when the scan happened, assumes the job of bartender in Ten Forward.
After considerable time, the ship's computer memory is finally reached, and La Forge brings up the manifest of the senior staff members. Among the bridge crew is listed the mysterious new member who is identified as Commander Keiran MacDuff, the executive officer. The computer also reveals what is apparently the Enterprise's mission: According to the orders, the Enterprise is part of a fleet of vessels fighting a decades-old war with the Lysians. Their current assignment is to destroy the Lysian central command headquarters, which they are to do while maintaining communications silence.
In the meantime, Ensign Ro concludes that she and Commander Riker are likely romantically connected, and pursues this relationship, while Deanna Troi also realizes she has feelings for the commander.
Doctor Crusher works to restore the memories of the crew, a process complicated when it's found that the medical records for the crew have been destroyed. She tries an experimental procedure on MacDuff, who apparently reacts poorly to the treatments, but later smiles when Crusher turns away.
Continuing toward the target, the Enterprise encounters a Lysian ship, which is easily destroyed. Picard becomes concerned with how mismatched the firepower of the Enterprise is compared to her supposed enemies. Picard complains to MacDuff that he feels as though he has been given a weapon, taken into a room and told to shoot a stranger. Ultimately, when faced with the Lysian central command, drastically incapable of fighting them off and with 15,311 people on board, Picard calls off the mission, stating that he does not fire on defenseless people. Angered by this action, MacDuff attempts to take control of the Enterprise. Instead, Riker fires a phaser at MacDuff, revealing that MacDuff is in fact some manner of alien. MacDuff struggles to activate the ship's weapons, but Riker and Worf defeat him.
Determining that there was an artificial effect suppressing the crew's memories, Dr. Crusher works to quickly restore them to the crew. MacDuff is identified as a Satarran, a race which has been at war with the Lysians for decades. Despite their skill with memory suppression, the Satarrans lacked sophisticated weapons technology, and so had plotted to hijack the Enterprise and tilt the war in their favor.
The plot foiled, Enterprise heads off to its next assignment—although Riker remains uneasy when he encounters Troi and Ro intensely conversing in the Ten Forward bar. Ro insists somewhat facetiously that they have a memory they will both treasure; Troi concludes that such actions tend to result from subconscious desires. When Riker concedes confusion, she curtly informs him that "if you're still confused tomorrow, you know where my office is."