The end of the Heian period was marked by a legendary feud between two great warrior families, the Minamoto (Genji) and the Taira (Heike). After the Taira routed the Minamoto, the third son of the Minamoto clan, called Yoritomo, was sent to live at a temple in Izu-hantō. When the boy grew old enough, he began to gather support for a counterattack on his clan’s old rivals. In 1180 Yoritomo set up his base at Kamakura, far away from the debilitating influences of Kyoto court life, close to other clans loyal to the Minamoto and, having the sea on one side and densely wooded hills on the others, easy to defend.
After victories over the Taira, Minamoto Yoritomo was appointed shōgun in 1192 and governed Japan from Kamakura. When he died without an heir, power passed to the Hōjō, the family of Yoritomo’s wife.
The Hōjō clan ruled Japan from Kamakura for more than a century until, in 1333, weakened by the cost of maintaining defences against threats of attack from Kublai Khan in China, the Hōjō clan was defeated by Emperor Go-Daigo. Kyoto once again became the capital.