The story begins in 1616, with Ieyasu gravely ill. He summoned two men to his bedside: the monk Tenkai, who served three Tokugawa shoguns, and the daimyo Tōdō Takatora. His request was that a place be made where the three of them could rest together in spirit for a very long time. The phrase for that is "three people, one place." It is also the origin of this shrine's alternate name, Sansho Gongen. Tenkai took that wish seriously. The second shogun, Hidetada, granted him the land that is now Ueno Park, where several lords, including Tōdō Takatora, had their secondary residences. Tenkai founded the great temple Kan'ei-ji there. Because Ueno hill lies in the northeast, the unlucky direction for Edo Castle, he conceived of it as an eastern counterpart to Mount Hiei, which guards the northeast of Kyoto. Within Kan'ei-ji's grounds, many halls and sub-temples were built. In 1627 one of them was the forerunner of today's shrine, first called Tōshō-sha. It was formally granted the title of a shrine, a gū, by the imperial court in 1646. And despite its shogunal pedigree, it did not stay exclusive. The people of Edo who admired Ieyasu came in numbers to worship here, so it became a shrine open to ordinary townspeople.