Kodai Sanjo (ancient castles built on the top of mountains) (古代山城)
Kodai Sanjo generally refers to ancient mountain castles built in the historical period from Asuka to Nara, which were influenced by the Korean Peninsula. Occasionally, these castles were also called Chosenshiki Yamajiro (the Korean style of mountain castles). However, since the origin in the form of this particular reference definition is uncertain, scholars in the study of archaeology usually settle on the term Kodai Sanjo for the mountain castles.
Kodai Sanjo refers to castles which was built in several locations of western Japan in ancient times and be written some statements in the 'Nihon-shoki' (the oldest chronicles of Japan) or 'Shoku Nihongi' (Chronicle of Japan Continued), or other lineage of these mountain castles. Nihon-shoki' and 'Shoku Nihongi' contained articles on construction, repair, discontinuation or abolition of Kodai Sanjo castles. Especially after the Battle of Hakusukinoe in 663, the Emperor Tenchi ordered the constructions of Mizushiro (castles on lakes or marshes erected for defensive reasons) and Yamashiro (castles built on the top of mountains or halfway up the mountains for defensive reasons) throughout the country in preparation for invasions by the Tang Dynasty and the Silla (ancient Korean Kingdom).
In the Nihon-shoki, it is written, 'The castle was built under the direction of exiled nobles of Kudara (Baekje, Paekche)' in the articles about Nagato-jo Castle, Ono-jo Castle (Chikuzen Province) and Kii-jo Castle. Including this feature described above, castles referred to as 'Kodai Sanjo' had some points in common such as construction periods and their architecture, and so on. Moreover, it is pointed out that some Kodai Sanjo castles, like Ito Castle, had a relationship with Chinese fortresses.
Additionally, as ancient structural remnants similar to Kodai Sanjo, the sixteen Kogo-ishi (rows of stones arranged on mountain slopes in Kyushu and Western Japan; also refers to "a mountain castle of Kogo-ishi style"), including Kinojo (ogre's castle) in Soja City (It was designated as a national historical site in 1986), were discovered throughout Japan. However, there is no official record of those Kogo-ishi castles, therefore, much of the construction process of these castles remains obscure. Some of the Kogo-ishi castles are supposed to be ones of the Kodai Sanjo castle group which are documented but whose location has not been confirmed yet. Additionally, other Kogo-ishi castles are found as "the multiunit remain for religious rituals in inmost village community" or "the castles which were constructed in a backwoods area by exiled clans coming from the Asian continent."
Further more, there were different systems of ancient castles: Miyakonojo (a capital or a city surrounded by castle walls), Kokufu-jo castle, sekisho (checking station), a fort, Mizushiro, a josaku (an official defense site) and Chinju-fu (Pacification and Defense Headquarters) in Tohoku and Hokuriku regions, and Jokan (a castle of mansion-style). Among those castles, Taga-jo castle and Akita-jo castle are located high enough to be considered as Yamashiro castles. Considering their scales, those two castles seem to be develop forms of the Kodai Sanjo castles in western Japan, so we need to be careful when categorizing ancient castles.