Legendary fictional detective Sherlock Holmes is depicted as having a rival or even arch-nemesis in Professor James Moriarty, a brilliant, dark-minded genius who is closely associated with Holmes even though Moriarty appears in only two of the official stories written by Sir Arthur Conan Doyle. Because Moriarty appears in only two of Conan Doyle's stories, his role as Holmes' archenemy can be seen as a more modern part of the Sherlock Holmes canon. Conan Doyle initially only introduced the Moriarty character as a way of being able to convincingly kill off the Sherlock Holmes character, which he did in the story "The Adventure of the Final Problem."
Conan Doyle apparently intended to permanently kill off Holmes in "The Adventure of the Final Problem," but the public outcry after this story was published was so intense that he eventually brought Holmes back. However, Moriarty didn't really factor into these original Sherlock Holmes stories again until the final novel, "The Valley of Fear." The idea of a seemingly superhuman character such as Holmes actually having an evil equal was apparently compelling enough for multiple people interpreting these stories, such as film director Guy Ritchie and the producers of the BBC series "Sherlock," to incorporate the Moriarty character into their narratives.
Holmes describes Moriarty as the "Napoleon of crime" who is an evil genius with a "phenomenal mental capacity." Moriarty only takes up about 20 pages in Sherlock Holmes novels; however, his impact is great, as the readers are allowed to fill in the rest of his character with their imagination. Doyle based Moriarty's character on Adam Worth, who was a real criminal mastermind.