In 984 AD, when Ryogen was 73 years old, while he was in his chamber doing shikan meditation, suddenly there was a gust of wind accompanied by a mysterious feeling and he asked, "Who are you?" "I'm the evil god who administers the plague. I've come to invade your body," was the answer. "So I am speaking with the god of the plague? OK, I'd like you to possess me just a little bit, right here," replied Ryogen, extending forth his little finger.
As soon as the evil god touched the tip of Ryogen's little finger, a chill ran throughout his entire body, quickly developed into a fever, and he was attacked with excruciating pain, Right there, having insight into the perfectly interfused Three Truths (ku-ke-chu), Ryogen by himself became a YAKSHA, he flicked his finger expelling the evil god, and his pain was healed.
He then thought, "if it had entered into several fingers, who knows how much pain there would be. Even more so, if the evil god should invade the body of one of the citizens, there would be no esape. This is truly a sorrowful situation."
Feeling great distress in his heart, the next morning Ryogen gathered his disciples and said, "whatever image you see reflected in the mirror, please make a sketch of it for me," and facing the mirror he entered into samadhi. Ryogen's form as reflected in the mirror slowly transformed, soon becoming an ogre covered with bones. The disciples, overcome with surprise and fear, could only prostrate themselves. Only one disciple, Myo-fu, was able to draw the strange image on the mirror. Coming out of meditation and seeing Myo-fu's sketch, Ryogen seemed to be completely satisfied and nodded approval, adding "Using this original drawing, you should carve a woodcut and print up o-fudas."
After the o-fudas were printed, Ryogen did the eye-opening ceremony and said, "Now quickly deliver these to each house and paste one on the door entrance for the benefit of the inhabitants. In places where this o-fuda is pasted, the evil demon will not enter. Furthermore, disasters will be repelled." The effect was magical.
That is how the folk custom of pasting the o-fuda, known as "Tsune Daishi," on doorways came into being.