Nijo Castle (二条城, Nijōjō) was built in 1603 as the Kyoto residence of Tokugawa Ieyasu, the first shogun of the Edo Period (1603-1867). His grandson Iemitsu completed the castle's palace buildings 23 years later and further expanded the castle by adding a five story castle keep. After the Tokugawa Shogunate fell in 1867, Nijo Castle was used as an imperial palace for a while before being donated to the city and opened up to the public as a historic site. Its palace buildings are arguably the best surviving examples of castle palace architecture of Japan's feudal era, and the castle was designated a UNESCO world heritage site in 1994. Nijo Castle can be divided into three areas: the Honmaru (main circle of defense), the Ninomaru (secondary circle of defense) and some gardens that encircle the Honmaru and Ninomaru. The entire castle grounds and the Honmaru are surrounded by stone walls and moats.