What is the origin of the phrase 'touch wood'?

The Internet says 'Touch wood is an example of a superstition: something that we do in order to have good luck. It is not based on human reason or scientific knowledge, but is connected with old ideas about magic and the supernatural' I am from India and I have heard urban Indians say it whenever they make a favorable observation. I am pretty sure the origin is not Indian. What is the story behind this phrase?


Here is the entry for "knock on wood" in Robert Hendrickson, The Facts on File Encyclopedia of Word and Phrase Origins, fourth edition (2008):

knock on wood. Why do we say knock on wood and tap wood or our heads after declaring that some calamity has never happened to us? The superstition is an old one and has many possible explanations, none sure. It may be of pagan origin, deriving from the practice of rapping on trees to ask protection from friendly spirits who were believed to reside inside. Or it could be a Christian superstition similar to touching wooden crucifixes or rosary beads. One theory even holds that the practice comes from games like hide-and-seek in which players who succeed in touching wood are safe from capture. A last far-fetched possibility is that the superstition is linked to a verse in the sixth chapter of Galatians: "God forbid that I should glory save in the cross of our Lord Jesus Christ." You will be forgiven any vainglorious boast, according to this story, if you quickly recall the wooden cross Christ carried.

I like the asking-for-help-from-the-tree-spirit theory best, but not because it seems especially plausible. Christine Ammer, The American Heritage Dictionary of Idioms (1997) has this:

knock on wood Also, touch wood. Express a wish that something will or will not occur. {Example omitted.] This expression alludes to an ancient superstition that literally knocking on or touching wood will ward off evil spirits. {c. 1900}

Finally there is the bit of advice from Journal of American Folklore (1892[?]):

If your right hand itch, you will get money. You should knock on wood, according to the saying, "Knock it on wood,/It will come good."