Before the establishment of the Kamakura shogunate, civil power in Japan was primarily held by the ruling emperors and their regents, typically appointed from the ranks of the imperial court and the aristocratic clans that vied there. Military affairs were handled under the auspices of the civil government. However, after defeating the Taira clan in the Genpei War, Minamoto no Yoritomo seized powers from the aristocracy. In 1192, Yoritomo and the Minamoto clan established a military government in Kamakura.
The Hōjō Regency
After Yoritomo's death, Hōjō Tokimasa, the clan chief of Yoritomo's widow, Hōjō Masako, and former guardian of Yoritomo, claimed the title of regent (shikken) to Yoritomo's son Minamoto no Yoriie, eventually making that claim hereditary to the Hōjō clan. Eventually, Tokimasa deposed Yoriie, backed up his younger brother, Minamoto no Sanetomo, as a new shōgun, and assumed the post of shikken. The Minamoto clan remained the titular shōguns, with the Hōjō holding the real power. In 1219, Sanetomo was assassinated by his nephew Kugyō. Since Sanetomo died childless, the line of shōguns from the Minamoto clan ended with him.
With the Regency, what was already an unusual situation became even more anomalous when the Hōjō usurped power from those who had usurped it from the Emperor, descending from Emperor Kōkō, who usurped it from the children of Emperor Seiwa. The new regime nonetheless proved to be stable enough to last a total of 135 years, 9 shōguns and 16 regents.
With Sanetomo's death in 1219, his mother Hōjō Masako became the shogunate's real center of power. As long as she lived, regents and shōguns would come and go, while she stayed at the helm. Since the Hōjō family did not have the rank to nominate a shōgun from among its members, Masako had to find a convenient puppet. The problem was solved choosing Kujo Yoritsune, a distant relation of the Minamoto, who would be the fourth shōgun and figurehead, while Hōjō Yoshitoki would take care of day-to-day business. However powerless, future shōguns would always be chosen from either Fujiwara or imperial lineage to keep the bloodline pure and give legitimacy to the rule. This succession proceeded for more than a century.
In 1221 Emperor Go-Toba tried to regain power in what would be called the Jōkyū War (承久の乱 Jōkyū no Ran), but the attempt failed. The power of the Hōjō remained unchallenged until 1324, when Emperor Go-Daigo orchestrated a plot to overthrow them, but the plot was discovered almost immediately and foiled.
The Mongols under Kublai Khan attempted sea-borne invasions in 1274 and 1281.
Fifty years before, the shogunate had agreed to Korean demands that the Wokou be dealt with to stop their raids, and this bit of good diplomacy had created a cooperative relationship between the two states, such that the Koreans, helpless with a Mongol occupation army garrisoning their country, had sent much intelligence information to Japan, so that along with messages from Japanese spies in the Korean peninsula, the shogunate had a good picture of the situation of the pending Mongol invasion. The shogunate had rejected Kublai's demands to submit with contempt. The Mongol landings of 1274 met with some success, however there was no rout of the Japanese defenders, who in any case greatly outnumbered the 40,000 combined invasion force of Mongols and Korean conscripts. Noting an impending storm, the Korean admirals advised the Mongols to re-embark so that the fleet could be protected away from shore; however, the typhoon was so destructive that one-third of the Mongol force was destroyed.
After the surviving forces returned to Mongol territory, Kublai was not dissuaded from his intentions on bringing Japan under Mongol control, and once again sent a message demanding submission, which infuriated the Hōjō leadership, who had the messengers executed. They responded with decisive action for defense—a wall was built to protect the hinterland of Hakata Bay, defensive posts were established, garrison lists were drawn up, regular manning of the home provinces was redirected to the western defenses, and ships were constructed to harass the invaders' fleet when they appeared.
The Mongols returned in 1281 with a force of some 50,000 Mongol-Korean-Chinese along with some 100,000 conscripts from the defeated Song empire in south China. This force embarked and fought the Japanese for some seven weeks at several locations in Kyushu, but the defenders held, and the Mongols made no strategic headway. Again, a typhoon approached, and the Koreans and Chinese re-embarked the combined Mongol invasion forces in an attempt to deal with the storm in the open sea. At least one-third of the Mongol force was destroyed, and perhaps half of the conscripted Song forces to the south over a two-day period of August 15–16. Thousands of invading troops were not able to embark in time and were slaughtered by the samurai. Such losses in men, material, and the exhaustion of the Korean state in provisioning the two invasions put an end to the Mongol's attempts to conquer Japan. The "divine wind," or kamikaze, was credited for saving Japan from foreign invasion.
For two further decades the Kamakura shogunate maintained a watch in case the Mongols attempted another invasion. However, the strain on the military and the financial expenditures weakened the regime considerably. Additionally, the defensive war left no gains to distribute to the warriors who had fought it, leading to discontent. Construction of defensive walls added further expenses to the strained regime.
Decline and fall
In 1331 Emperor Go-Daigo took arms against Kamakura, but was defeated by Kamakura's Ashikaga Takauji and exiled to Oki Island, in today's Shimane Prefecture. A warlord then went to the exiled emperor's rescue, and in response the Hōjō sent forces again commanded by Takauji to attack Kyoto. Once there, however, Takauji decided to switch sides and support Daigo. At the same time another warlord loyal to the emperor, Nitta Yoshisada, attacked Kamakura and took it. About 870 Hōjō samurai, including the last three Regents, committed suicide at their family temple, Tōshō-ji, whose ruins were found in today's Ōmachi.
In 1336, Ashikaga Takauji assumed the position of shōgun himself, establishing the Ashikaga shogunate.