Shrine Shinto priests have been involved in governance since ancient times, and in the Heian period, they incorporated the Taoist concept of Inyo (Onmyo) gogyo shiso (yin and yang and the Five Elements) into their beliefs and practices and in so doing, obtained official positions in the government as Onmyoji (masters of divination and sorcery).
神社神道の神主などの神職は、古くから政（まつりごと）の執政をし、平安時代には道教の陰陽五行思想を取り込むことによって陰陽師という組織とその政治における官僚としての役職を得た。