was settled by the Ainu, Nivkh, and Orok before recorded history. The "Nihon Shoki", finished in 720 AD, is often said to be the first mention of Hokkaido in recorded history. According to the text, Abe no Hirafu led a large navy and army to northern areas from 658 to 660 and came into contact with the Mishihase and Emishi. One of the places Hirafu went to was called , which is often believed to be present-day Hokkaido. However, many theories exist in relation to the details of this event, including the location of Watarishima and the common belief that the Emishi in Watarishima were the ancestors of the present-day Ainu people. 

During the Nara and Heian periods (710–1185), people in Hokkaido conducted trade with Dewa Province, an outpost of the Japanese central government. From the Middle Ages, the people in Hokkaido began to be called Ezo. Hokkaido, formerly known as Ezochi or . The Ezo mainly relied upon hunting and fishing and obtained rice and iron through trade with the Japanese. 

During the Muromachi period (1336–1573), the Japanese created a settlement at the south of the Oshima Peninsula. As more people moved to the settlement to avoid battles, disputes arose between the Japanese and the Ainu. The disputes eventually developed into a war. 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. They held authority over the south of Ezochi until the end of the Edo period in 1868.
Why did they trade with them?
which was granted exclusive trading rights with the Ainu