This ancient temple is said to have been founded by the priest Gyoki in the year 726. The name of the temple (meaning "Demon Rock Temple") is an alternate pronunciation of the Chinese characters for "Oni Iwa", the name of the boulders and cave on the mountain behind the temple. It is said that the priest Kobo Daishi Kukai trapped a demon that was plaguing the locals inside of the cave. On the premises of the temple, there is an enshrined "Devil Scratch Stone", which is said to bear the marks of the devil sharpening its nails. There is also Kuroinu Shrine, which enshrines the sacred black dog Kuro, and the legend about him. In addition, excavations have revealed a large number of stone pagodas (designated cultural properties of the city) from the Age of North and South Dynasties period (1336 - 1392) to the Age of Warring States (1467 - 1615).