For most of its history, the city of Kyoto was the Imperial capital of Japan. The history of the city itself can be traced back as far as the 6th century. In 544, the Aoi Matsuri was held in Kyoto to pray for good harvest and good weather.
Kyoto did not start out as the capital of Japan. A noteworthy earlier capital was Nara. In 741, Emperor Shōmu moved the capital briefly to a place called Kuni-kyo, between the cities of Nara and Kyoto, in present-day Kyoto Prefecture. In 784, the capital was moved to Nagaokakyō, also in present-day Kyoto Prefecture. In 794, Emperor Kammu moved the capital to Heian-kyo, and this was the beginning of the current-day city of Kyoto. Even today, almost all of the streets, houses, stores, temples and shrines in the city of Kyoto exist where they were placed in this year.
Although in 1192 real political power shifted to Kamakura, where a samurai clan established the shogunate, Kyoto still remained the imperial capital as the powerless emperors and their court continued to be seated in the city. Imperial rule was briefly restored in 1333, but another samurai clan established a new shogunate in Kyoto three years later.
In 1467, a great civil war, the Ōnin no Ran, took place inside Kyoto, and most of the town was burned down. Japan plunged into the age of warring feudal lords. A new strong man, Tokugawa Ieyasu, established the shogunate at Edo (today's Tokyo) in 1603.
The Meiji Restoration returned Japan to imperial rule in 1868. Emperor Meiji, who was now the absolute sovereign, went to stay in Tokyo during the next year. The imperial court has not returned to Kyoto since then. During the instigation of Fuhanken Sanchisei in 1868, the prefecture received its suffix fu. The subsequent reorganization of the old provincial system merged the former Tango Province, Yamashiro Province and the eastern part of Tanba Province into today's Kyoto Prefecture.
Although many Japanese major cities were heavily bombed by U.S. bombers during World War II, the old capital escaped such devastating bombing. During the occupation, the U.S. Sixth Army was headquartered in Kyoto.