One wouldn’t believe there'd be much crossover potential between the tales of a daring, egotistical Victorian detective and the adventures of a space-traveling starship, but that’s exactly what happens in numerous takes on both the stories of Sherlock Holmes and Star Trek. Whether it's the conscious quoting of the detective’s famous phrases, homages paid in the naming of starships, or the crossover between actors appearing in various adaptations, there’s more overlap between the two than one might think. Here are 12 times Sherlock Holmes and Star Trek referenced each other in the most interesting of ways.

1. Spock quotes one of Sherlock Holmes’ most famous lines in Star Trek VI: The Undiscovered Country.

In one of the most recognizable moments in Trek history, Spock says, “An ancestor of mine maintained that if you eliminate the impossible, whatever remains, however improbable, must be the solution.” The original quote, from the Holmes story The Sign of the Four, published in 1890, reads, “How often have I said to you that when you have eliminated the impossible, whatever remains, however improbable, must be the truth?”

2. Spock might be related to either Holmes himself or to Sir Arthur Conan Doyle.

The Vulcan’s claim that the original source of the quote—which could be interpreted either literally as Holmes himself or as Doyle—is one of his direct human descendants is one of the more interesting asides in all of Star Trek. The idea that Spock is related to either Holmes or his creator makes sense when one considers how similar everyone’s favorite science officer is to the Victorian detective: they’re both highly logical, attentive to detail, and both see emotions as hindrances to the ability to think rationally.

3. Alternate reality Spock, from the 2009 reboot Star Trek, also paraphrases the famous quote.

He says, “If you eliminate the impossible, whatever remains, however improbable, must be the truth.” It’s another slight paraphrase, and not attributed to Holmes like it was in The Undiscovered Country, but is a nod to the detective nonetheless.

4. The co-writer of three Star Trek films also wrote several famous Sherlock Holmes pastiches, including The Seven-Per-Cent Solution, which he also adapted into a screenplay.

In 1974, Nicholas Meyer wrote the novel The Seven-Per-Cent Solution, published as a “lost manuscript” of Watson. Meyer adapted The Seven-Per-Cent Solution into a screenplay for a film of the same name in 1976, for which he was nominated for the Academy Award for Best Adapted Screenplay. Meyer also co-wrote the screenplays for Star Trek II: The Wrath of Khan, Star Trek IV: The Voyage Home and The Undiscovered Country. In the audio commentary for The Undiscovered Country special edition, Meyer commented, “Star Trek fans are just as likely to be Sherlock Holmes fans.”

5. There’s a starship named after Holmes in Star Trek: The Next Generation.

In a small, nearly unrecognizable moment in TNG, a screen displaying a United Federation of Planets call log shows a ship named for Doyle’s famous character. Christened the USS Sherlock Holmes and given the registry number NCC-221B, after Holmes’ residence, it appears only briefly, and if viewers aren’t watching carefully, they’ll miss it.

6. Lt. Commander Data’s interest in learning about and imitating the detective is explored in TNG

In the Season 1 episode “Lonely Among Us,” Data finds his interest piqued when Captain Picard and Commander Riker discuss Sherlock Holmes. After using the Enterprise computer to research Holmes and read all of Doyle’s stories, Data begins imitating the detective, smoking a pipe and saying phrases like, “Indubitably, my good woman,” and “It’s elementary, my dear Riker,” much to the amusement of the crew. Data, too, paraphrases the famous Holmes quotation abbreviated by Spock, saying to Picard, “We must fall back upon the old axiom that when all other contingencies fail, whatever remains, however improbable, must be the truth.”

7. ...leading to a TNG episode modeled after the Basil Rathbone era of Sherlock Holmes films.

After Data discovers his interest in Holmes, his friend and fellow Enterprise officer Lt. Commander Geordi La Forge asks him to solve Holmesian mysteries using the ship’s Holodeck in the Season 2 episode “Elementary, Dear Data.” The two, with Data as Holmes and La Forge as Watson, dress up in full Victorian regalia and explore the Holodeck-created settings, modeled after the 1939-1946 series of films starring British actor Basil Rathbone. Trouble arises when La Forge asks the computer to create an opponent worthy of facing the highly intelligent and logical Data; the Holodeck generates a version of Moriarty that becomes self-aware, attempting to take over the Enterprise by hijacking the computer systems. Picard promises to save Moriarty’s consciousness in the ship’s computers, to be released when they discover a way to give him a proper existence.

8. Just like in Sherlock Holmes’ universe, Moriarty proves hard to defeat, resurfacing later in another TNG episode.

In the Season 6 episode “Ship in a Bottle,” Moriarty returns to the Enterprise, despite having been (peacefully) vanquished in the earlier episode. Demanding the crew of the Enterprise follow through on their promise to give him a reality, Moriarty takes control of the starship once again, threatening them with total destruction if they do not fulfill his wish.

9. In a Star Trek comic, Data reprises his role as Holmes to save Counselor Deanna Troi.

In the WildStorm Comics one-shot comic “Embrace the Wolf,” an entity known as Redjac commandeers the Enterprise’s Holodeck and recreates Victorian London, assuming the role of Jack the Ripper. To rescue Troi and other crew members trapped on the Holodeck, Data uses his disguise as Sherlock Holmes to defeat the evil being.

10. In the BBC reboot Sherlock, John Watson compared Sherlock to a famous Star Trek character.

In the Season 2 episode “The Hounds of Baskerville,” the modern Sherlock Holmes paraphrases, once again, the same quote remembered by Data and both incarnations of Spock, saying, “Once you’ve ruled out the impossible, whatever remains, however improbable, must be true.” Watson later says to Sherlock, “Alright, Spock, just take it easy.” The cleverness of this reference is that Watson had, presumably, been attributing the earlier quote to Spock in The Undiscovered Country, when in actuality he is quoting an earlier incarnation of Holmes himself.

11. Watson’s eulogy for the famed detective in Sherlock closely resembled the eulogy given for Spock by Captain Kirk in The Wrath of Khan… and Khan writer Nicholas Meyer was a fan of the similarity.

In the Season 2 episode “The Reichenbach Fall,” when Holmes appears to have died after jumping from a tall building, Watson eulogizes him at his gravestone, saying, “You were the best man, and most human human being that I've ever known.” This touching phrase sounds eerily similar to Kirk’s words about Spock following his death in The Wrath of Khan: “Of my friend, I can only say this: Of all the souls I have encountered in my travels, his was the most... human.” Fans of both Sherlock and Trek were quick to make the comparison, and Meyer, who co-wrote The Wrath of Khan, remarked, “I love new Sherlock; it’s nice to know they return the favor!”

12. Many actors from the Star Trek and Sherlock Holmes incarnations have appeared in versions of both.

In the mid-1970s, Leonard Nimoy, who portrayed the original Spock, played the detective in a stage adaptation, titled Sherlock Holmes. Nimoy said of his role as Holmes, “He's an asocial man, hardly your average 9-to-5 worker with a family. Instead, he's chosen a very special kind of life, and he has very little respect for most of the people around him who are also involved in his profession. He's an outsider, in so many ways—particularly in his relationships, with women. Holmes is very much an alien, all right, and I felt that I could understand him the same way I understood Spock.” Additionally, Christopher Plummer, who played Chang in The Undiscovered Country, also portrayed Holmes in several TV adaptations of stories about the detective, as well as the 1979 Holmes movie Murder by Decree. Frank Langella, who played Minister Jaro in Star Trek: Deep Space Nine, took on the character of Holmes for an episode of the 1976–1982 TV series Standing Room Only, and Benedict Cumberbatch, perhaps best known as Holmes in the BBC reboot, played Khan in the 2013 incarnation Star Trek Into Darkness.