In 794, the capital was moved from Heijo-kyo Palace in Nara to Heian-kyo Palace in Kyoto. The dairi which housed the emperorfs private quarters and administrative offices was near the current Nijo-jo Castle. Nijo-jo Castle was built by the Shogun Ieyasu Tokugawa and is where the 15th generation Shogun Yoshinobu Tokugawa returned the reigns of government to the imperial court. From the Heian period until the end of the Edo Period, this was the center of politics for the authoritarian at the time. It was the ghearth of the capital in Kyoto.