Riker, looking very disheveled, is deep in conversation with an unseen doctor. It soon becomes clear that he's in an insane asylum, brought there until he can stand trial for his actions. Riker steadily loses what little cool he has, and in the end has some sharp words for the doctor:

"You've told me what to eat and what to think and what to say - and then, when I show a glimmer of independent thought, you strap me down, you inject me with drugs and you call it a treatment!" "You're becoming agitated." "You bet I'm agitated. I may be surrounded by insanity, but I am not insane, and there's no ... no ..."

Riker breaks away from the character he's been portraying with Data, and asks director/ playwright Beverly Crusher if he can try the speech again. She disagrees, saying that they've all made "a lot of progress" with it, and suggesting that although Riker's character has a great many problems to wrestle with, Riker himself should relax.

Riker agrees and leaves. He walks down the hall rehearsing the speech in his mind, but stops when he reaches the turbolift and sees a strange face that he doesn't recognize...

Some time later, Picard briefs Riker on an upcoming assignment at Tilonus Four. The government there has collapsed, and a Federation research group has disappeared. The knowledge they have of advanced technology would be invaluable to any of the various factions trying to seize power on the planet, and so Riker will be assigned to get them out, undercover.

Worf briefs him on the specifics of the mission and on the culture of the planet, including methods to communicate with the Enterprise and safety precautions. Riker takes it all seriously, but not seriously enough for Worf, who suggests he pay closer attention. Worf also shows him an example of combat with the local knife, but accidentally nicks Riker in the forehead in the process.

Riker goes to sickbay to get it looked at, and although it heals with no problems, Riker's surprised to find that it still hurts. Suddenly, he finds himself reacting very strangely when a burn victim is brought in, and quickly leaves. He mentions the incident to Troi, who dismisses it and the uneasiness he's felt ever since starting the play as due to facing emotions for the role he's rarely dealt with. Riker sees the same person whose appearance in the turbolift earlier shocked him, and decides to go to bed early.

The play goes well, with Riker hitting the final speech perfectly. Data, as the doctor, says dispassionately, "I can see we have a lot of work to do," and leaves as Riker screams to him that he's not crazy. As the play closes, Data receives warm applause, and Riker receives a standing ovation. However, on his second bow, he sees the same strange individual standing between Picard and Worf - and on the third...

...He finds himself in the same "room" that was in the play, but it is now enclosed. The applause is gone, and in its place - a doctor, smiling, and saying "I can see we have a lot of work to do."

The doctor doesn't believe in the Enterprise, referring to Riker's claim to having just been in the play as "the ship again...". Riker, already a bit on edge, is now very distraught, unable even to remember who he is with any great confidence. The doctor, Doctor Syrus, attributes the pain in Riker's head to an escape attempt the previous evening; the cut Riker received from Worf in his fantasy was this same cut, transposed. Riker discovers to his horror that he's in the Tilonus Four Institute for Mental Disorders, and Syrus refuses to tell him why, instead leaving and promising to talk more later. "You're making excellent progress."

Very shortly afterwards, a remote voice asks Riker if he wants to spend some time out in the "common room". Riker agrees, and is led there by two large attendants, one of whom gets him his lunch. While Riker sits and prepares to eat, a woman sits down with him, saying "I hear you're a Starfleet officer." She claims to also be from Starfleet, abducted for various tortures and experiments, and tells him a rescue mission is imminent - then calls her "ship" on a spoon.

The guard, Mavek, takes the spoon away from the woman and talks to Riker. He insults Riker's "progress" and taunts him about his past. Riker becomes more and more agitated as Mavek continues, and when Mavek finally reveals that Riker is there for killing and mutilating a man, Riker snaps and attacks him. Riker is pulled off, and Mavek gives him an injection -

- and Riker wakes up in his quarters on the Enterprise in a cold sweat.

Later, Riker tells Bev about it as he gets made up for the play. She is concerned, but figures it'll be all right.

The play goes well, until the closing sequences. In the final scenes, Riker at one point sees Mavek staring at him from backstage and freezes. He also hears strange noises and loses his grip on the scene, and finally sees the strange person who's been dogging his footsteps again. He attacks this man, demanding to know who he is, but is shocked to hear him say he's simply Lieutenant Suna. Beverly takes Riker to sickbay.

There, she finds no sign of neurological damage, and attributes Riker's problems to simple fatigue. Riker is more paranoid, asking her to check for drugs in his system, but when they turn up negative as well he takes her advice and heads to get some rest.

En route to his quarters, he talks to Troi, who reassures him that everyone understands. She suggests some relaxation techniques, but as he remarks that they never work for him he hears a voice saying "Perhaps you need another treatment." He freezes, but shakes it off.

He gets into the turbolift, which then opens onto the asylum corridor. He panics, but covers his eyes and insists it isn't real. He walks out onto the hallway of the Enterprise and walks down more comfortably. When he turns a corner, however, he sees the woman inmate from the asylum, who says, "Don't let them tell you you're crazy." Panicked, he runs to Troi's quarters, goes in -

- and hears the door slam shut on his asylum cell. "Help me! Help ... me ..."

In the common room, Riker begs Syrus for help, saying that his shipboard experiences seem warped and hellish, and that only the hospital feels real to him. Syrus is pleased to hear Riker reject his delusions, and adds that legal issues will soon force Riker's treatment along one way or the other. He gives Riker a choice: "reflection therapy", in which Riker will openly confront various facets of his personality, or surgery to alter the aspects of his personality which caused his illness. Riker chooses the former, even knowing the unpleasantness involved.

In the therapy session, Riker speaks to his raw emotions, represented by Troi ("there's still a great deal of you that believes you're on a starship"), his actions, represented by Worf, and logical thought reasoning the connections between the two, represented by Picard. "Picard" tells him that he was followed into an alley and grabbed from behind. "How many?" "Three. Humanoid. I only saw the face of one of them." "What did he look like?"

The imager produces "Lt. Suna", who Syrus identifies as the hospital administrator. "What part of me does he represent?" "I have no idea."

Suddenly, Troi steps forward, telling Riker not to believe any of this. "You're still with us, on the Enterprise." Riker refuses to believe her, even when Worf and Picard add their voices as well, warning him that he's in danger. He tells them they're all delusions and wills their images away. Syrus is impressed; "we'll continue later..."

Later, as Riker sits in the common room eating, he sees Beverly coming towards him and looks away, saying "it's not real". She sits down across from him and tells him that he was captured during the mission to Tilonus Four, and that the authorities are telling Starfleet that he killed someone. The hospital administrator isn't even acknowledging Riker's presence, so the work is going slowly - but, she assures him, they will get him out soon.

That evening, Riker wakes up when he hears a noise. Worf and Data break into his room and attempt to rescue Riker. However, he rejects their help, breaking free from Data long enough to cry for assistance and then taking Worf's phaser away. However, even given that, the guards don't manage to capture anyone, and Riker is returned to the Enterprise.

There, in sickbay, Bev says he's had damage to long-term memory that will take a while to fix. Riker looks as though he's been put through a ringer, and the cut on his temple is back. Bev reassures him that it's minor and heals it. After Picard discusses some of the aftermath, Riker puts his hand to his head in pain and finds the cut again. The shock of seeing its return makes him suspect the Enterprise isn't real, and he causes chaos long enough to grab a phaser and break away. At first, he threatens everyone else. "If I'm right, you're not really here. This isn't a real phaser - it's all a fantasy, and I'm going to destroy it any way I can."

"What if it isn't a fantasy?", Picard asks calmly. "Are you willing to kill to take that chance?"

"You're right," Riker smiles, "I'm not. But-" and he slowly turns the phaser on himself- "I'm going to find out what's real and what's not." He fires, and the scene around him shatters...

... and he finds himself in the asylum, where Dr. Suna is getting a progress report. Suna concludes that Riker will need the surgery. However, Riker realizes that he's still holding a phaser. "It's not a phaser, it's a knife ... give it to me." Riker stares at Suna, then feels a pain in his head and feels the cut return to his temple. He decides that this scenario isn't real either and "shatters" Mavek. "None of this is real!" He sets the phaser high enough to destroy half the building and fires -

- and finds himself on stage with Suna on the Enterprise. "You're the only constant," he realizes, "the only person in both places! This isn't real either." Suna tries to reassure him, but he feels the cut return to his head again - "You're lying!!" "Let me help you." "No!"

The audience bursts into applause. Riker continues to fight Suna, finally pushing him into a wall. He runs to the "cell" door and bashes himself against it. Both he and the scene shatter...

...and Riker wakes up to find himself on a lab table, being milked for neural information. He fights his way clear, grabbing both his knife and the pendant he used for communications, and manages to successfully beam out with Suna watching helplessly.

Some time later, with Riker's memory fixed properly, the pieces are put together. He was abducted two days after his arrival, and was put through a particular neurosomatic technique to have information taken from him. The scenario he went through, Troi reasons, was his own mind's defense mechanism against the treatment, trying to latch on to any familiar settings possible to keep him sane. "You should get some rest," Picard advises: "we can talk some more tomorrow." "There's one thing I'd like to do first."

And after clearing it with Beverly, Riker begins striking the set of her play.