The time of rule by shoguns and warlords in Japan is referred to as the Japanese feudal period. During the feudal period, as military rule took over, the emperor's rule was restricted to religious matters. Feudalism in Japan lasted from the 12th until the 19th century. Its military-led warrior culture emerged partly in response to the threat of Mongol invasions in the 13th century. After Japan defeated the Mongols, a sense of national unity developed and the Japanese felt their culture was superior. Japan, however, had reaped no rewards from war, only debts; and unpaid samurai terrorized peasants to obtain money. The samurai drove the reigning Kamakura shoguns (1185-1333) from power, and the Muromachi shoguns (1333-1573) that followed them failed to maintain control. Provincial officials established themselves as warlords and fought each other in the Onin war (1467-1477), leading to the spread of feudal rule as the central government collapsed.