Jugonshi (呪禁師)
Jugonshi (sorcerers) were a type of official who worked in the Bureau of Medicine under the Ritsuryo system. They were in charge of jugon (magical spells and charms). The number of government positions for jugonshi was fixed at two, and their rank was equivalent to Shohachiinojo (Senior Eighth Rank, Upper Grade).
The jugonshi came into existence through the influence of Daoism on Japan, and carried out medical treatments by purifying any ailments caused by supernatural or magical forces. There are examples from ancient times of a sort of proto-jugonshi, who used spells containing elements of Buddhist prayers mixed in (see for instance the section on the year 577 in the "Nihonshoki" (Chronicles of Japan)), but full-blown jugonshi do not appear in the written record until the section of the "Nihonshoki" describing the year 691).
Under the Ritsuryo system, the jugonshi were considered indispensable for their spells, their medical treatments of the sick and their efforts to make childbirth safer, and the most outstanding from among the jugonshi was appointed jugon hakase (Master Sorcerer, with only one such fixed position); the jugon hakase worked to train and cultivate the jugonsei (apprentice sorcerers, for whom six fixed positions existed). But with the later occurrence of the Enmi kotoku jiken (an incident in which a witch doctor committed murder), jugon itself began to be seen as dangerous, and furthermore the practice of jugon was abandoned by the end of the eighth century due to the rise of onmyodo (the yin-yang arts of magic and divination), which also derived from Daoist incantations; by the dawn of the ninth century, even the institution of jugonshi had disappeared.