Originally, the festival invoked the help of the gods against a plague in medieval Kyoto; highly commercialized imitations of it are now celebrated all over the country.
There were not any festivals in medieval Kyoto.