In 1185 Minamoto no Yoritomo won the right to appoint military stewards (shugo) and estate keepers (jitō), and in 1192 took the title of sei-i taishōgun, seating his bakufu at Kamakura: a dual polity emerged, the imperial court keeping court rank and ritual authority while the bakufu controlled military and police affairs nationwide through shugo and jitō. After three generations the Minamoto line died out; the Hōjō family ruled as hereditary regents (shikken), and the 1232 Goseibai Shikimoku became the fountainhead of warrior law. Two invasions by the Yuan were repelled (1274 and 1281 - the origin of the 'divine wind' legend), but the unpaid war costs seeded unrest. Emperor Go-Daigo's attempts to overthrow the shogunate failed (the Shōchū plot of 1324, the Genkō rising of 1331); in 1333 Kusunoki Masashige in the south and Nitta Yoshisada in the east rose together, Kamakura fell, the Hōjō were annihilated, and the bakufu ended after one hundred and forty-eight years.