In the early Heian period (794-1185), under the rule of Emperor Kanmu (reigned 781-806), the government regarded any powerful person who did not obey them as a threat, calling them “demons.” Kumano pirate Tagamaru was also regarded as a demon, and Shogun Sakanoue no Tamuramaro was ordered by Emperor Kanmu to subjugate him. Inhabitants of heaven revealed to Sakanoue no Tamuramaro that Tagamaru was hiding out near the Onigajo cliffs.
The Shogun's army attempted to attack the cliffs, but from the land, Tagamaru was protected by sheer towering rocks, while strong waves pounded the beach, making it impossible to approach from the sea. Just then, a child appeared on Mamirugashima, an offshore island, and began singing and dancing, comically throwing up his arms and legs. The soldiers began mimicking him, and pandemonium eschewed. Tagamaru was hiding behind Onigajo's solid rock door, but the instant he poked his head out to see what was going on, Sakanoue no Tamuramaro killed him with an arrow. Tagamaru's remains were buried at Oma-jinja (Ido Town, Kumano City), and his story continues to be told today in association with Onigajo (a World Heritage site) as one of the many demon legends of this area.