Commander Riker's birthday celebration is interrupted as he, Geordi La Forge, and Worf beam down to a huge underground cavern on an uninhabited Class M planet to investigate unusual readings. After their arrival, the cavern unexpectedly fills with toxic gases, and the three officers fall unconscious. Worf and La Forge are beamed up without incident, but the Enterprise is unable for some reason to get a transporter lock on Riker.

Riker awakens in sick bay to find that sixteen years have passed. He is now Captain of the Enterprise, Data is his first officer, and Picard has been promoted to admiral, with Deanna Troi serving as his aide. His amnesia, according to Doctor Crusher, is a side effect of a viral infection he contracted during the away mission 16 years before â the last event he currently remembers before waking up. She informs him that his memory of the intervening events may or may not return in time.

Riker also learns that he was married, is now widowed, and has a son (Chris Demetral) named Jean-Luc (named after Picard). He is further startled when Tomalak â a former archenemy of the Enterprise, now a Romulan ambassador â beams onto the ship to negotiate a peace treaty with the Federation.

As events progress, numerous inconsistencies arise. The Enterprise computer consistently lags as Riker makes inquiries into his past. Data is unable to answer when Riker rapidly asks him computational questions. And finally, Riker's late wife "Min" is revealed to have been Minuet, the fictional holodeck character he fell in love with in the first-season episode "11001001". Riker realizes that the entire "future" he has been experiencing is a charade and confronts Picard and Tomalak on the Enterprise bridge, where more proof that none of this is real arises; Data cannot make a calculation that he should be able to make with his positronic brain, and then he uses a contraction, which Riker knows full well that he cannot do.

Suddenly, the program freezes and the false future fades away, revealing an advanced Romulan holodeck. "Ambassador" (actually Commander) Tomalak is revealed to be the perpetrator of the deception, the object of which was to trick Riker into giving away the location of a key Federation outpost. The Romulans, Tomalak explained, had been fooled by the intensity of Riker's memories of Minuet and had incorporated her into their fantasy on the assumption that she was real.

Riker is put in a holding area, where he meets the boy whose image the Romulans had used to create his "son". The boy identifies himself as "Ethan." Together, they manage to escape and briefly elude their Romulan guards. However, as the two are hiding from their pursuers, Ethan inadvertently refers to Tomalak as "Ambassador", instead of "Commander". Riker realizes that he is still in a simulation; confronting Ethan over it, he demands that the game end immediately and that he be allowed to leave.

Everything disappears once more, leaving only Riker and Ethan in the cavern the Enterprise away team had originally been exploring. Ethan confesses that he had created the simulations, using sophisticated scanners to read Riker's mind and create the "reality" he experienced. Ethan's planet had been attacked and his people killed; his mother had hidden him in the cavern for his own safety, with all the simulation equipment, before she herself died; and Ethan, all alone, had been yearning for companionship. Riker realizes the peaceable intentions of Ethan, who reveals his true form as an insectoid alien named Barash, and offers him refuge on the Enterprise. Barash accepts, and the two friends beam onto the ship.