There was originally no custom of enshrining the former because it was an evil deity having harmful influences, but along with the introduction of Buddhism, a custom of setting an evil deity as a guardian deity by enshrining evil deities such as yaksha (Buddhist guardian deities sometimes depicted as demonic warriors) and rakshasa (a type of evil spirit) in India was introduced.
前者は害悪をなす悪神であったので、これを祀るものは本来なかったが、仏教の伝来とともにインドに行われた夜叉・羅刹などの悪神を祀り、これを以って守護神とする風習が伝わった。