Jim Moriarty’s second appearance in Sherlock was right at the end of season 2’s second episode, where he was released from jail by Mycroft Holmes – but why was he there in the first place? The Great Detective has been adapted to all types of media for over a hundred years, and thanks to recent versions, his stories have regained popularity. Among the most recent adaptations is the BBC’s series simply titled Sherlock, with Benedict Cumberbatch as the title character and Martin Freeman as Dr. John Watson.

Sherlock brought the detective and some of his most famous cases to the present day, with modern London as the main setting and with Sherlock Holmes using technology to his favor (to an extent, of course). The series didn’t forget about some of the most memorable characters from Sir Arthur Conan Doyle’s stories, such as Irene Adler (Lara Pulver), Mary Morstan (Amanda Abbington), and Jim Moriarty (Andrew Scott), Sherlock’s archenemy. Moriarty played a big role in season 2 and was the one responsible for the Reichenbach fall in season 2’s finale, but before that, he spent some time in jail, though why exactly he was there has confused fans.

Related: Sherlock: Why The Girl Screams When She Sees Holmes In Season 2

Moriarty made his debut in season 1’s finale “The Great Game”, where he posed as Molly’s boyfriend and revealed his real identity to Sherlock and John right at the end. In season 2, viewers (and Sherlock) learned that Moriarty had been working with Irene Adler, who he gave advice on how to manipulate Sherlock and Mycroft. However, in the following episode, “The Hounds of Baskerville”, right at the end, Moriarty was shown in a cell, with Mycroft about to let him free. The next time viewers saw Moriarty, he was setting in motion a very elaborate plan to frame Sherlock and prompt him to kill himself, and why he was in jail the episode before wasn’t revealed.

Moriarty in Sherlock

Fans have since come up with different reasons as to why Moriarty was in prison in season 2, based on the character’s personality, what he did, and also what Mycroft was like in Sherlock. Although Moriarty did a lot of things that should have sent him to prison, he was too smart to let that happen, so Mycroft sending him to prison for something he did seems unlikely – what’s very possible, however, is that Moriarty let himself be captured, just like he did in season 3’s finale “The Reichenbach Fall”. Being captured was part of his big plan, as he needed as much information on Sherlock as he could get, and he saw that chance in Mycroft, with whom he exchanged information. Mycroft, then, was responsible for Sherlock’s “death” in “The Reichenbach Fall”, as he was the one who gave Moriarty all the information he was looking for.

That scene of Moriarty in prison at the end of “The Hounds of Baskerville” isn’t there just for the sake of having an extra something, but to show how far Moriarty’s obsession with Sherlock went, as he scratched his name on the walls and the two-way mirror. Moriarty’s (possibly brief) time in prison was key in setting the Reichenbach Fall story into motion, though a bit more of context wouldn’t have been bad.

Next: Sherlock Holmes' Original Death Was A Bigger Deal Than People Realize