Professor James Moriarty was a hologram created by Geordi La Forge, based on the fictional character of the same name. He was created for Sherlock Holmes Program 3A as an adversary capable of outwitting Data.
Moriarty's creation was unintentional and the direct result of a discussion between Data, La Forge, and Doctor Katherine Pulaski about Data's ability to solve problems like Sherlock Holmes would. Doctor Pulaski contended that Data could solve these problems because he had memorized all the Sherlock Holmes novels, but would not be able to solve a new Sherlock Holmes-based mystery. When La Forge suggested creating a mystery where Data's solving abilities could be tested, Pulaski told him Data would fail and agreed to take part in it. A short time after the mystery had begun, Data solved it with little effort, whereupon Pulaski accused Data of fraud, as she felt that it was not an original mystery but a variation on a theme. During this discussion, they were already watched by Moriarty. La Forge then decided to let the computer create an opponent for Data, and told it to create an adversary with the ability to defeat Data, not just Sherlock Holmes. After this command was given, the bridge registered a power surge while the Moriarty hologram appeared dazzled. When asked by a female companion about his condition, he replied that he felt "like a new man".
Familiarizing himself with sentience
Since Moriarty had heard the commands used by La Forge, he made the arch appear himself and inquired about its purpose. He was informed that it was used for entering computer commands. He resolved to gather more information, and decided to follow the three officers. After some time, Moriarty decided to abduct the woman of the group, Doctor Pulaski, and he hid her in an abandoned warehouse.
As time went by Moriarty became more aware of his own consciousness, seeing strange images inside his head that he could not name. Because clear signs were left behind when Doctor Pulaski was abducted, Moriarty was soon found by La Forge and Data. Moriarty welcomed them as Holmes and Watson, and also as not being Holmes and Watson. He told them they both looked familiar to him but then again also not familiar. He informed them that strange realities were part of his consciousness, and that he was aware of an oracle greater than Delphi's named "computer." After he summoned the arch, he gave a stunned Data a drawing he had made, a drawing of the Enterprise, and told them he knew it was a vessel of some kind and that he, and they, were aboard it. Data and La Forge immediately left the holodeck and took the image to Captain Jean-Luc Picard.
Meanwhile, Moriarty was courteous to the captive Doctor Pulaski, enjoying her company and discourse. He offered her tea and scones while he questioned her, and told her that he already knew who Picard was, although Pulaski said she had never heard of him. Moriarty showed her machinery he had built which he could use to control the Enterprise. He showed this same machinery to Picard, who entered the holoprogram with Data and La Forge. Moriarty told Data that this was about more than just ending a holodeck adventure, and he told Picard that he only wanted to exist. Moriarty made clear to Picard that he was well aware of his surroundings, and shook the Enterprise by means of his self-made machinery. When Moriarty asked Picard if he could leave the holodeck, Picard informed him of the limitations of the holodeck and that the matter and energy created by the holodeck could not exist outside of it.
Rights as a sentient being
Unpersuaded, Moriarty argued that he found himself alive, and as such had a right to live, to exist. He used Data as an argument – Data after all was a machine and yet considered alive, and he made the argument, "I think, therefore I am." Picard told Moriarty that at this time they would not be able to give him what he wanted, because they did not know how to convert holodeck matter into a permanent form.
Moriarty continued to press his case and told Picard that he did not want to die, who replied that he did not want to kill him. After Moriarty said goodbye to Dr. Pulaski, he summoned the arch and returned the holodeck controls to the main computer, and put his fate in Captain Picard's hands. Moriarty knew the Enterprise had a vast library memory, and Picard told him that they would use it to save his program, and that they would continue to try to find a way for him to exist outside of the holodeck.
Return and leaving the holodeck
In 2369, four years after Moriarty's program was stored, Data and La Forge were again running a Sherlock Holmes holonovel, when they found some discrepancies and asked Lieutenant Reginald Barclay to check on the program and the holodeck. When Barclay found the protected memory, he unlocked it and ran the program it contained. Moriarty appeared and asked Barclay if Captain Picard was still in command of the Enterprise. A confused Barclay listened as Moriarty explained who and where he was, and asked Barclay if Picard had found a way to enable him to leave the holodeck. Barclay responded that Moriarty could still only exist inside the holodeck.
Surprisingly, it seemed that Moriarty was aware of the passing of time while he was stored in protected memory. Moriarty asked how long he had been away, remarking that it had seemed longer than four years and asked to speak with Captain Picard. When he was told by Barclay that he had to store him in memory again, Moriarty appeared to cooperate, but in fact remained active after Barclay left the holodeck.
Moriarty did not know if Picard would help him this time and devised a ruse. He met Picard in Holmes' room at 221B Baker Street. Moriarty did not believe Picard when told that he had not been forgotten and that Starfleet's finest scientists had not found a way to allow him to leave the holodeck. He told Picard that it was a matter of willpower, and when Picard summoned the holodeck exit, Moriarty walked through it before anyone realized what he had done. A stunned Picard and Data walked up to him and could not understand how this was possible. Moriarty was told by Picard that he needed to be examined and was taken to Doctor Beverly Crusher, who found nothing wrong with him and that other than unusual DNA, he was Human. (TNG: "Ship in a Bottle")
Help in bringing out the Countess
The newly liberated Moriarty was given a tour of the Enterprise by Captain Picard and looked at the stars when they entered Ten Forward. When Picard expressed concerns about the criminal behavior his character was known for, Moriarty told him that this was all fictional and had nothing to do with real life. Moriarty asked Picard if the Countess Regina Barthalomew, the love of his life, could also be brought off of the holodeck like himself. Picard told the Professor that they did not understand why Moriarty could leave the holodeck and had no idea how to replicate the feat.
Despite Picard's assurances that Barclay and Data would investigate the possibility of bringing the Countess off of the holodeck, Moriarty decided to force the issue and took control of the Enterprise. Unknown to Picard, Moriarty had already changed the command codes into his own so he could override every command entered. The situation was made more critical by the impending collision of two planets in the Detrian system, which the Enterprise had been monitoring.
After making his demands, Moriarty returned to Baker Street, where he found the Countess Barthalomew together with Barclay, who placed pattern enhancers around a chair to test whether they could use the transporter to beam something off the holodeck into the real world. The attempt failed, but it gave Data the clue he needed to realize how Moriarty had left the holodeck; he had instead created a holographic representation of the ship, with Picard, Data and Barclay – the only people who had been in the holodeck when he created this illusion – real people.
Unaware of Picard's discovery of his deception, Moriarty contacted Commander Riker on the bridge, and asked about their progress in getting him off of the holodeck. When Riker replied that they had made no progress, Moriarty informed them of the experiment with the transporter and reminded Riker that he had nothing to lose by allowing the Enterprise to be destroyed by the planetary collision.
When Moriarty returned to Baker Street, he was informed by the Countess Barthalomew that Picard had told her that it might be possible to bring them off the holodeck by un-coupling the Heisenberg compensators before transport. Moriarty asked her if she had heard it correctly, and when she confirmed it he grinned. She told him that before Picard would try this, however, he wanted control of his ship back. Moriarty summoned the arch and told Commander Riker about Picard's plan.
Moriarty and the Countess Barthalomew stood between activated pattern enhancers to be beamed off the holodeck. After the transport, they met Commander Riker, and Moriarty told him that he would only return the command codes when he and the Countess were off the Enterprise, and he demanded a shuttle. Riker reluctantly agreed.
Moriarty entered the shuttle together with his beloved Countess, and Riker suggested they head for Meles II, as the range of the shuttle was not unlimited. When the shuttle departed the Enterprise shuttlebay, Moriarty released the command codes to the Enterprise main computer. When the Countess asked him if one day they would return to Earth he assured her they would.
Unknown to Moriarty, Data and Picard had created a program within the program, allowing Moriarty to believe he had departed the holodeck despite actually remaining within it. Picard and Data then ended the program the moment the command lockouts were removed, and left the holodeck a few minutes later. Moriarty and the Countess Regina Barthalomew would spend the rest of their lives inside a memory module, unaware of their situation, for as far as they were concerned they had left the Enterprise to live their lives in the real world. (TNG: "Ship in a Bottle")
The events surrounding Moriarty's re-emergence were ultimately taught at Starfleet Academy. Before his graduation in 2370, Harry Kim was one of the Academy cadets to learn of Moriarty. (VOY: "Alter Ego")
Moriarty's history would be covered in the Starfleet database and included on all starships. In 2373, Chakotay looked up the information on the USS Voyager's database when investigating the possibility of another sentient holodeck character (although the character was later revealed to have come under the control of an outside intelligence rather than having become sentient herself). (VOY: "Alter Ego")
"It has described a great monstrous shape on which I am like a fly – stuck on a turtle's back – adrift in a great emptiness."
- - Moriarty, on his perception of the Enterprise and his place on it
"I think, therefore I am"
- - Moriarty, shortly after "leaving" the holodeck
Moriarty was played by Daniel Davis.
René Echevarria, Ronald D. Moore and Brannon Braga were very eager to bring the Moriarty hologram back in a seventh season episode of Star Trek: The Next Generation. Though Echevarria later forgot what happened to Moriarty in the proposed story pitch, he reckoned the character would likely have realized he had been duped, thereafter managing to escape from the memory module and yet again threaten the Enterprise-D. The notion of reusing Moriarty for this plot was disallowed by Michael Piller. Echevarria explained, "I think Michael's idea was, 'You're never gonna get a better ending for that character than you did in 'Ship in a Bottle', you know, so let's leave him there.'" In response, though, Michael Okuda stated, "He was such a charismatic and fun character." ("Lower Decks" audio commentary, TNG Season 7 Blu-ray special features)
The holographic Moriarty served as the basis for The Doctor on Star Trek: Voyager. This was evidenced in a specific note, handwritten by Jeri Taylor during the conceptual development of that series and dated 30 July 1993. The note read, "Holo-Moriarty". Further notes, dated 3 August 1993, suggested the holographic doctor as a regular character "who, like Moriarty, has 'awareness' of himself as a holodeck fiction." (Star Trek: Voyager - A Vision of the Future, pp. 179, 175 & 177)
Moriarty returns in the novel The Light Fantastic where he kidnaps a revived Lal to force Data (who has also been resurrected) to provide him and Countess Barthalomew with physical bodies. It is revealed that Moriarty and the countess learned that they had never escaped from the holodeck when the Enterprise crashed on Veridian III, the crash causing data loss which erased Moriarty's holographic daughters Sophia and Gladys from existence. By the end of the novel, Moriarty and Barthalomew have received their physical bodies and their daughters have been restored.