[Darwin wrote] "If worms have the power of acquiring some notion, however rude, of the shape of an object and of their burrows, as seems to be the case, they deserve to be called intelligent; for they then act in nearly the same manner as would a man under similar circumstances."-- from Chapter 4 of Created From Animals: The Moral Implications of Darwinism by James Rachels (1990).
Where we find animal behavior that is closely analogous to what we would expect from humans in similar circumstances, and where there are no experimental grounds for distinguishing between them, the animals must be regarded as intelligent, to at least some degree, if humans are so regarded. Anything else, Darwin thought, is illogical and unfair. The best proof we have of the seriousness he attached to this principle is that he would not depart from it even in the case of worms. Considered in this light, Darwin's discussion of "the mental powers of worms" turns out to be not just the crankish musing of an old man, but a telling choice of example.