Goryō

In a broad sense, Goryō (御霊) is an honorific for a spirit, especially one that causes hauntings, and the term is used as a synonym for vengeful Japanese ghosts (怨霊). In a narrower sense, it refers to a person who was a noble or accomplished person in his or her lifetime, but who lost a political power struggle or died prematurely from an epidemic or other disease, becoming a that brings pestilence or famine and is later enshrined as a  in Shinto shrines. For example, the "Sandai Jitsuroku" (a historical Japanese document) mentions that six Shinto shrines were dedicated to the worship of, which were the spirits of those who died from non-natural causes. Later on, two more shrines were added, bringing the total to eight.

Belief in goryō (御霊信仰) refers to the belief that the of people who have died unfortunate deaths cause hauntings and disasters, and the belief that they are enshrined as  to appease them.

Description
The name consists of two kanji, 御 (go) meaning honorable and 霊 (ryō) meaning soul or spirit.

The belief that the spirits of those who died with resentment or anger after being treated unfairly caused hauntings existed before the Nara period (710–794). However, from the Nara to the Heian periods (794–1185), the belief arose that the spirits of those who died after being defeated in a power struggle among the nobility caused plagues and natural disasters, and Shinto shrines were built to appease their spirits and enshrine them as. The first example is Prince Sawara, who was stripped of his position as crown prince and exiled to Awaji Island to die in 785. After his death, a plague epidemic broke out in Kyoto, which people feared was caused by his spirit. So the Kamigoryo Shrine (ja) was built in Kyoto in 794 to appease his spirit, and he was enshrined as a.

An example of a is the Shinto kami known as Tenjin: Government official Sugawara no Michizane was killed in a plot by a rival member of the Fujiwara clan. In the years after his death, the capital city was struck by heavy rain and lightning, and his chief Fujiwara adversary and Emperor Daigo's crown prince died, while fires caused by lightning and floods destroyed many residences. The court drew the conclusion that the disturbances were caused by Michizane's. In order to placate him, the emperor restored all his offices, burned the official order of exile, and he was promoted to Senior Second Rank. Even this wasn't enough, and 70 years later he was elevated to the post of Daijō-daijin, and he was deified as Tenjin-sama, which means "heavenly deity". He became the patron god of calligraphy, of poetry and of those who suffer injustice. A shrine was established at Kitano. With the support of the government, it was immediately raised to the first rank of official shrines.