Pull your horns in

What is the origin of the phrase "pull your horns in"?

The horns in question are those of the snail, who pulls his horns back into his shell whenever he is threatened. (VSD)