Mitama Magahara is the final boss of the fanmade Touhou Project videogame, Mystical Power Plant. A vengeful spirit who made the newly brought Life-Guiding Tree that gives Gensokyo energy go haywire as she tried to fill it with electric power.
She was once a dweller of the outside world, where she had a completely different appearance; she was also acknowledged as a famous poet, a renowned scholar and even held a high position at an Imperial Court. Unfortunately, her opponent managed through politics to demote her from her rank of junior-second to a lesser official post and was transferred to the capital of a different province. This proved harmful to her persona and Mitama died a lonely death. After that, several disasters struck the descendants of the Emperor and virtually any person who took part in her exile: Rainstorms and lightning struck the Parliament office and death fell upon the Emperor's sons. People saw this as a sign that the vengeful spirit of Mitama had come to haunt them so they built several shrines in her honor to calm her down and she even gained the status of a deity, the god of learning.
Mitama arrived in Gensokyo when Kanako brought a mystical tree, the Life-Guiding Tree, hoping to bring technological advancements and progress to the land, the tree was guarded by Mitama. Convinced by Tenmu and unaware of the Tengu's evil intentions, Mitama saw this as an opportunity for the outside world to develop and began gathering power to feed the tree. When it was full enough, she would use the power to bring the tree and all of its properties to the outside world, with the possibility of destroying Gensokyo, the heroine's world, contemplated.
Mitama is based on Sugawara no Michizane; a famous Japanese scholar, politician and poet. He was a talented poet and archer, and held several positions in the imperial court. As a result of a conspiracy by his political enemy, Fujiwara no Tokihira, he was demoted and sent to the city of Dazaifu, where he died. His death was followed by natural disasters and the deaths of several members of the Fujiwara clan, said to be caused by his vengeful spirit. To pacify his spirit, all charges against him were wiped from the records and he was deified as Tenjin, a god of scholarship that is still widely worshipped today.