"Goryo-e" is a courtesy for reposing the soul, to prevent curses by the goryo (spirit of the deceased person) who died unexpectedly, and is also referred to as Goryo-sai Festival.
Goryo originally meant spirit of a deceased person. During the Heian period, its meaning changed from shiryo (spirit of a dead person) of someone who died in an accident caused by onryo (revengeful ghost). Natural disasters were all believed to be the acts of goryo, and this led to the creation of courtesies expressed to goryo. Additionally, during the Heian period, on May 20, 863, Goryo-e was held in the Shinsen-en Garden.
Emperor Sudo, Imperial Prince Iyo, Fujiwara no Yoshiko, Tachibana no Hayanari, and Funya no Miyatamaro were referred to as such, and became objects of Goryo-e.
Later, the two spirits of Sugawara no Michizane (845 - 903), Kibi no Makibi (693 - 775), and Empress Inoue (717 - 775) were added to create Hassho goryo, and are enshrined in Kamigoryo-jinja Shrine and Shimogoryo-jinja Shrine in Kyoto.
Additionally, the Gion Goryo-e (Gion-e) at the Yasaka-jinja Shrine, where Gozu Tenno (deity said to be the Indian god Gavagriva) is enshrined, is known as Gion-matsuri Festival
The pacification of Sugawara no Michizane, who was feared as the Karai tenjin (god of fire and thunder), is known nationwide as the Tenjin-shinko Faith.