The Kyoto basin was first settled in the 7th century, and by 794 it had become Heian-kyō, the capital of Japan. Like Nara, a previous capital, the city was laid out according to traditional Chinese geomancy in a grid pattern modelled on the Chinese Tang dynasty capital, Chang'an (contemporary Xian).
The ensuing Heian period (literally 'Peace and Tranquility') lived up to its name. Over the next four centuries the city became Japan's cultural and commercial centre as well as its political hub. In this time, isolation from China allowed a native Japanese culture to emerge. Arts and literature flourished, spurred on by the development of a unique Japanese character set called hiragana, and the court reached the apogee of elegance.
However, while the city was to serve as home to the Japanese imperial family from 794 to 1868 (when the Meiji Restoration took the imperial family to the new capital, Tokyo), from the 9th century the imperial family was increasingly isolated from the mechanics of political power. In the provinces a new power was on the rise - the samurai or military class - with an armed force that defended the group's autonomy. Samurai families moved into Kyoto where they muscled in on the court, causing mayhem. This was the beginning of the Shogun feudal system, when a succession of military clans ruled the country until imperial power was restored in 1868.
Despite the decline of the court, Kyoto continued to prosper economically. The Ashikaga period was marked by flourishing arts and the construction of beautiful temples and gardens - many still standing today - but the rest of the country was slowy slipping into civil chaos. In 1467 a feudal argument ignited the most ferocious battle in Kyoto's history. The 90,000-strong Yamana army faced off against the 100,000 soldiers of the Hosokawa. The 10-year Onin war was fought mostly in the centre of Kyoto, destroying most of the city and scattering the population.
The war marked the start of the chaotic Warring States period until 1568, when power was seized by Oda Nobunaga, who used his military genius to consolidate power throughout central Japan. His program continued following his suicide and, by 1590, the whole country had fallen under the rule of 'Mr Monkey' - Hideyoshi. At the time of his death, Hideyoshi had completely rebuilt Kyoto and its population had swelled to 500,000. Soon after a rival government was set up at Edo, and the emperor's authority became nominal.
In Edo, the Tokugawa family virtually rebuilt society, imposing a strict hierarchical social structure and enforcing international seclusion. In Kyoto, a push to increase the power of the shogun led to a wave of antigovernment sentiment and a state of internal unrest. In 1868 the shogun resigned and Japan was again reunified, and began emerging from isolation. Over 1000 years, Kyoto had fought back from its considerable loss of power by using its strongest weapon - culture.