In this question, it is established that Sherlock Holmes, from the works of Sir Arthur Conan Doyle was asexual and in explaining that it is stated that he showed very little emotion in general. This led me to wonder if he was religious in any of the books. Based on the text of the works of Sir Arthur Conan Doyle, do we know if Sherlock Holmes was religious? If so, how was this displayed in his actions?
The single strongest piece of evidence is surely this, from A Naval Treaty:
"Thank you. I have no doubt I can get details from Forbes. The authorities are excellent at amassing facts, though they do not always use them to advantage. What a lovely thing a rose is!"
[Holmes] walked past the couch to the open window, and held up the drooping stalk of a moss-rose, looking down at the dainty blend of crimson and green. It was a new phase of his character to me, for I had never before seen him show any keen interest in natural objects.
"There is nothing in which deduction is so necessary as in religion," said he, leaning with his back against the shutters. "It can be built up as an exact science by the reasoner. Our highest assurance of the goodness of Providence seems to me to rest in the flowers. All other things, our powers our desires, our food, are all really necessary for our existence in the first instance. But this rose is an extra. Its smell and its colour are an embellishment of life, not a condition of it. It is only goodness which gives extras, and so I say again that we have much to hope from the flowers."
which on its face is a declaration of religious faith, though not necessary any sort of orthodoxy.
I think the main thing that gives the impression that Holmes wasn't religious is his highly analytical, evidence-seeking character. Nowadays, this usually goes along with religious skepticism. Less so in Doyle's time, though. And the analytical evidence-seeking sort of skeptic these days is usually a very scientific sort of skeptic ... and it doesn't seem hard to imagine (e.g.) that someone as uninterested in pure science as Holmes is portrayed as being (recall that he didn't know the earth went around the sun rather than vice versa) might be unfamiliar with the palaeontological evidence that life on earth is very old, or with the evolutionary ideas that make "arguments from design" so much less impressive now than they were a couple of hundred years ago.
The other evidence is, I think, much weaker.
Holmes speaks of "going down to chapel" in The Adventure of the Gloria Scott but I think that tells us nothing. He was at university at that point, probably Oxford or Cambridge. The Oxbridge colleges have chapels; they are universally called chapels rather than (e.g.) churches; and in Holmes's time I believe attendance was compulsory. So the fact that he went doesn't mean he was religious, and the fact that he called it "chapel" doesn't mean he was Catholic.
Holmes shows himself familiar with the story of David and Bathsheba in The Crooked Man but that's a very famous story, and would have been more universally known then than now.
Holmes tells a criminal "You will have to answer ... at a higher court than the Assizes" in The Boscombe Valley Mystery, which certainly could indicate belief in an afterlife and some sort of post-mortem judgement -- but it could also just be intended to scare the criminal.
Holmes praises "patient suffering" in The Adventure of the Veiled Lodger, which would fit well with a Christian (perhaps more specifically a Catholic) background, but the idea that suffering has merit is pretty widespread (and I suspect was more so in the 19th century when Christianity was more deeply ingrained in the culture than it is now).
In The Adventure of the Cardboard Box, Holmes says "What object is served by this circle of misery and violence and fear? It must tend to some end, or else our universe is ruled by chance, which is unthinkable. But what end? There is the great standing perennial problem to which human reason is as far from an answer as ever." whose first half seems to indicate something like religious belief and whose second half seems to indicate the contrary. I think we can infer that he was neither the sort of atheist who is convinced that our universe is in fact ruled by chance (and necessity), nor the sort of believer who thinks it's perfectly obvious that the answer to that "perennial problem" is given by their own religion. But there's plenty of territory in between, both religious and irreligious.
Holmes did some work for the Pope, but there's no indication that he did it out of a sense of religious obligation rather than because he was being paid to do it. He's described as having worked for any number of other eminent figures.
From time to time Holmes says "my God" and "breathes a prayer of gratitude" and so forth. Anyone, religious or not, could do those things, and both religious and irreligious people frequently do.
This isn't the sort of question that should expect a definitive answer. (Especially as it's not unknown for people's religious position to change, as Doyle's certainly did.) If I had to guess at what Doyle would have said if pinned down, it's that Holmes was convinced (on what he considered empirical grounds) that there must be some sort of divinity behind the universe, but that he thought everything beyond that unknowable and uncertain. But there's nothing resembling a statement of that (or any other) particular view in the canon, and my guess is based as much on what I think Doyle's own position was as anything else. I think he could have made Holmes a Catholic, or an Anglican, or a Huxleyesque agnostic, without any internal contradictions.
He is possibly (most likely) Catholic.
Let's look at some extracts:
The Gloria Scott - dog bit his ankle 'as I went down to chapel' - chapel typically a catholic word in English
The Crooked Man - shows knowledge of bible when he identifies the epithet David - might just know the bible but could indicate Catholicism
The Boscombe Valley Mystery - tells criminal "You are yourself aware that you will soon have to answer for your deed at a higher court than the Assizes" - indicating belief in afterlife
Several Books 'For God's Sake!' - a religious curse
The Blue Carbuncle - "it is just possible that I am saving a soul… Besides, it is the season of forgiveness." - believes in souls and forgiveness
This all points to Holmes being religious, and most likely Catholic.
However there is a lot of atheist evidence. For instance he praises a highly atheist book - Martyrdom of Man - in the sign of the four. So there is some doubt.