 Takeda Nobuhiro killed the Ainu leader, Koshamain, and defeated the opposition in 1457.Nobuhiro's descendants became the rulers of the Matsumae-han, which was granted exclusive trading rights with the Ainu in the Azuchi-Momoyama and Edo periods (1568–1868).The Matsumae family's economy relied upon trade with the Ainu.