Nijo Castle is a flatland castle in Kyoto. It was built as the residence of the first hereditary military dictator, Tokugawa Ieyasu, in 1603. After the shogunate fell in 1867, the castle was used as an imperial palace for a short period, and was then donated to the city and opened to the public as a historic site. It was designated a UNESCO world heritage site in 1994.