In 1185, Minamoto Yoritomo emerged victorious from power struggles among the noble families. He was given military titles and legitimate authority by the emperor. He appointed his vassals as protectors over one or more provinces. He was given the title of shogun in 1192. This was the beginning of the Kamakura shogunate.
The Kamakura shogunate provided order and peace in Japan for almost 150 years. When the Minamoto family died out in 1219, the powerful Hojo family installed new puppet shoguns. The Hojo controlled the shoguns as the Fujiwara had earlier controlled the emperors.
In the late 1200s, the Mongols conquered China and Korea. Kublai Khan sent a delegation to Kyoto to demand tribute, but the Hojo leader refused. In 1274, the Mongols launched an invasion of Japan. The fleet never made it to Japan, because it was driven back by storms. In 1281, the Mongols launched another invasion fleet. The Mongols managed to land in Japan this time. The Japanese kept the invaders contained to the beach for two months. Japanese ships wreaked havoc with the Mongol fleet. A typhoon then struck, destroying as much as half of the Mongol fleet and forcing them to withdraw. The Japanese celebrated the kamikaze, or "divine wind," of the typhoon.
After the Mongol invasions, the army was kept together for several more years to defend against any further invasion. None came. The cost of defense was high. Commanders could not reward their samurai with the spoils of battle, because there were none. Feudal ties of loyalty were weakening. The breaking point came during an imperial succession dispute in 1331. The civil war lasted 50 years and for a time, there were two imperial courts. The Hojo family was slain in 1333, however.
The powerful daimyo Ashikaga Takauji sided with the court that remained in Kyoto. In 1338, he was rewarded with the title of shogun. He and his descendants kept the title until 1573. The Ashikaga shoguns never established full control over Japan. The daimyo only grudgingly accepted the shoguns as overlords. The next 200 years were marked with disorder and war.
In 1467, the shoguns lost all their power as Japan fell into a state of constant warfare. Daimyo carved up Japan between them, and fought with each other for control and land. The issued their own legal codes for their lands. Samurai became an officer class. Large numbers of foot soldiers became the backbone of the military. All resources were devoted to increasing military power.
In the late 1500s, warlords emerged who united parts of Japan under them. The most famous were Oda Nobunaga, Toyotomi Hideyoshi, and Tokugawa Ieyasu. Through years of warfare, they ground down opposition. By 1590, Hideyoshi had reunified Japan. Hideyoshi also launched invasions of Korea in the 1590s, but these failed and he was forced to withdraw. When he died, he left an infant son, with Tokugawa Ieyasu as his guardian. Ieyasu crushed his opponents in 1600, and three years later, he established the Tokugawa shogunate. The age of warfare had ended.