Original air date: January 25, 1993
Data and Geordi are enjoying a Sherlock Holmes holodeck mystery when Data's suave reveal - involving the left-handedness of one of the suspects - is stopped in its tracks, as it turns out the suspect is apparently right-handed after all, even though according to this particular mystery, he was supposed to be left-handed. They stop the program and call Lieutenant Barclay in to check things out, who does a few diagnostics, then finds a locked program on the holodeck memory. When he asks it to run, who should appear but Professor Moriarty. It's been about four years since Data first granted him accidental sentience and he was subsequently left in the memory banks with a promise to find a way to free him. Unfortunately, he hasn't been "asleep" during that time as was intended; he has been trapped and aware of his surroundings (such as they were), waiting to get out and, as he puts it, slowly going mad. When Barclay tells him that he hasn't heard of Moriarty's situation and truthfully admits that there still isn't any technology to allow him to leave the holodeck, Moriarty gets angry and he demands to meet Picard, who'd made the promise to help him.
In the meantime, the ship is monitoring the impending birth of a new star, which will involve the collision of two gas giants. Picard is called down to the holodeck, and with Data and Barclay, he enters to talk to Moriarty. Picard is apologetic for both Moriarty's inadvertent imprisonment and the lack of progress in finding a way of allowing him to exist in the real world. Not only is Moriarty upset, but now he says that he can't trust Picard to work in his interest, and he demands some sort of assistance to free himself from the Holodeck. Picard insists that it's impossible to get him out, and to demonstrate his point, he tosses a book through the open door, letting the simulated matter flash away into nothingness as it crosses the barrier. Moriarty claims that he is different, being alive, and that if he is just a computer simulation, it won't be a huge loss if he vanishes. So he steps beyond the door.
And he's just fine. He's out of the Holodeck, and doing just fine. The crew is understandably quite confused and want to work to study how this was possible, while Moriarty takes in the glory of the twenty-fourth century for the first time. Moriarty soon realizes that he's all alone in the future, though, and wants to to bring the Countess, a character written to be his love whom he's truly fallen in love with on his own, into the real world with him. When he feels like the crew of the Enterprise isn't doing enough, he takes over the commands, demanding that they immediately devote their efforts to helping his love, or he'll let the ship drift into the star.
Barclay meets the charming Countess as they try their experiments with creating real matter from holodeck matter. The process is a failure, but Data hopes to learn something from the results, but when he looks at the results, nothing is there, as if they had never tried their experiment. Down in Engineering, LaForge tries to help Picard get back into control of the computer, but even after putting in his command override, it still won't respond. Data notices that Geordi is switching handedness and explains to Picard that he now understands what has happened: When he, Picard and Barclay entered the holodeck for the first time, they never left afterward. The simulation was extended to include the rest of the ship. The lack of any results from their beaming experiment was because the real ship had no information on what would happen. And since they're still in the holodeck, now Moriarty has Picard's command codes. And he's locked them out of ending the program.
In real life, Moriarty contacts the bridge, having taken control of the ship, and demands that the crew start working on bringing them out of the holodeck for real—when Geordi and Riker sound like they don't think it'll work, he starts raising the temperature of the warp core until they agree to work on bringing him out into the actual real world. Picard goes to visit the Countess in the holodeck (within the holodeck that the simulated Enterprise is in) and asks her to talk to Moriarty about releasing the ship, appealing to her good nature and offhandedly mentioning that they had found a way to Technobabble their way to transporting holodeck matter. The Countess tells Moriarty about the nonsense solution, and Moriarty relays it to the real Enterprise's Riker.
Reluctantly, Riker beams Moriarty and the Countess aboard the real Enterprise, where they arrive safely. Moriarty demands a shuttlecraft for him and the Countess to leave to explore the stars in, and it is given to them. As they fly out into space, Moriarty gives his command override code to the Enterprise. Then Picard steps out, tells the computer to end the program, and Riker disappears along with the shuttle bay, returning to the grid of the holodeck.
Because, as is revealed, Picard had programmed a holodeck inside of the simulated Enterprise—so when Moriarty thought he was transporting out of the simulated Enterprise to escape to reality, he was in fact calling out to another holodeck program, nested inside his own. With the command codes restored to him, Picard frees the others, and they emerge from the real holodeck. Barclay pops a clear glowing cube out of the holodeck's computer as they leave.
The Enterprise moves back to safety, and Moriarty and the Countess are held in the cube, which is simulating the galaxy for them. Barclay puts the cube into a power source that will keep running and allow them to live out their lives exploring their simulated microcosm. Picard makes an offhand mention about how their own universe could be just an elaborate simulation for some unknown purpose, and once everyone else has left, Barclay nervously says, "Computer, end program." Nothing happens, and he looks relieved as he leaves to put Moriarty and the Countess somewhere safe.
As the credits start to play, we get a shot of the star-to-be they've been watching finally forming into a star in a big burst of red light.
Contains Examples of:
- A Glitch in the Matrix: Data realizes that the ship is a holodeck program because Geordi is left-handed in the program, but right-handed in real life. Amusingly, Barclay uses the trope name several years before the actual Trope Namer when he first began investigating the holodeck.
- All Girls Want Bad Boys: Picard asks the Countess what she (who was apparently designed to be a person of "impeccable integrity") sees in a man like Moriarty. She essentially lays this out as the reason.He's an exciting man, Captain. He's brilliant, incisive... he's ruthless. He has an almost irresistible appeal.
- And I Must Scream: Moriarty was aware of the passage of time while he was deactivated.Barclay: You couldn't have been aware of the passage of time Moriarty: But I was. Brief, terrifying periods of consciousness... disembodied, without substance.
- Anti-Villain: All Moriarty wants is to be given the opportunity to live, and do so with the woman he loves.
- Artistic License History: Moriarty refers to his past as a mere fiction, "the scribblings of an Englishman dead now for four centuries." However, Sir Arthur Conan Doyle was Scottish.
- Artistic License: Which hand somebody catches an object with is not a sure-fire way of determining their handedness. Most people would prefer to catch with their dominant hand but most people are perfectly capable of catching with the other if needed, like if they were already holding something in their dominant hand...as Data himself demonstrates by also catching the matchbook with his right hand. Brent Spiner himself is left-handed so Data clearly is ◊as well. ◊
- Bittersweet Ending: Moriarty didn't get exactly what he wanted, but he's enjoying some semblance of life outside the holodeck with his love.
- The Bus Came Back: They wanted to bring Moriarty back earlier, but they had gotten in a bit of trouble with Sir Arthur Conan Doyle's estate; when they used Moriarty in "Elementary, Dear Data," they didn't realize he wasn't yet in the public domain. It took them a little while to get that straightened out.
- Chekhov's Gun: While playing Holmes in the beginning, Data and Geordi see that the holodeck is malfunctioning, as a character is right-handed when he's supposed to be left-handed. Later, one of the ways Data realizes they're trapped in the holodeck is seeing that Geordi is apparently left-handed when in reality he's right-handed, using the same method: tossing an object in their direction.
- Deadpan Snarker: The Countess. Dont be fooled by her bright-eyed perkiness: the woman has some game.Picard: Ive come here to prevail upon your intelligence and your insight.Countess: But not, apparently, my humility.
- Deliberate Values Dissonance: The Countess, from Victorian times, brags about how she went on an African safari and got to wear trousers the whole time.
- Failed a Spot Check: In the holodeck program at the beginning, Data fails to notice when the suspected murderer catches an object in his right, rather than left, hand; Geordi has to point it out to him. For a human this could easily be explained as him getting caught up in the program, but this is Data we're talking about.
- It's because Data genuinely did figure out the intended mystery that was programmed in. He just took it on faith while acting as Sherlock that he was correct because he was supposed to be...but it took Geordi pointing out the program was malfunctioning.
- Foreshadowing: A hint to the audience that all is not right is that from the time Picard, Data, and Barclay enter the holodeck to when Moriarty contacts the real Riker, there are no external shots of the Enterprise.
- Gilded Cage: The solution is to lock Moriarty and the Countess in a computer simulation where they can never escape but can live out a long and pleasant life.
- Hoist by His Own Petard: Picard used Moriarty's plan to turn the tables on him.
- Leaning on the Fourth Wall: "All this might just be an elaborate simulation running inside a little device sitting on someone's table." Said by Picard from inside your TV set, which in the 1990s would probably have been sitting on some kind of table. Barclay then waits for the room to clear out, before nervously muttering "Computer, end program," thus ending the episode of the television program that you are currently watching.
- Oh, Crap!: Picard, when he realizes that, in their attempt to override Moriarty's control of the computer, he's actually given him his access codes and allowed him to take control of the ship for real.
- Shout-Out: When Riker (the real one) demands to Moriarty that he gives back control, Moriarty tells him "I'm afraid I can't do that.".
- Spoiler Title: If you think about the episode title for a while, it's not hard to figure out Moriarty's plan before it's revealed.
- Spotting the Thread: Data spotting the fact that Geordi is suddenly left-handed tips him off to Moriarty's whole plan, just like he was supposed to do in his Sherlock Holmes mystery.
- Technobabble: Disabling the Heisenberg compensators has nothing to do with allowing Moriarty to leave the holodeck, it's just the crew's excuse as part of their counter-ruse. (Appropriately, the compensators themselves only exist to Hand Wave the transporter's physics-defying abilities. It runs on magic as far as the audience is concerned.)
- That Man Is Dead: Moriarty tells Picard that because of his self-awareness, he is no longer the literary foe of Sir Arthur Conan Doyle's creation.
- Title Drop: Moriarty describes what he created as a ship in a bottle for Picard, Data, and Barclay. It also ends up describing the situation they in turn create for him and the Countess inside the holodeck cube, right down to them having their own simulated ship (the shuttle) to be trapped in.
- Well-Intentioned Extremist: Moriarty.
- What Happened to the Mouse?: Invoked by Moriarty, who is understandably angry to discover he'd been forgotten about.
- What the Hell, Hero?: Moriarty criticizes Picard for having never kept his promise from the end of "Elementary, Dear Data." Picard counters that they really did try to address the issue, but it's pretty clear that Moriarty was never exactly a priority on anyone's radar.
- Worthy Opponent: Despite his frustrations, Moriarty has the utmost respect and admiration for Picard.
- You Remind Me of X: When Picard seeks to sweet-talk Countess Bartholomew into persuading Moriarty to release control of the ship, she (figuring out that he's being charming on purpose) remarks that he reminds her of a Viscount Oglethorpe, "a man who could bewitch any woman who breathed".