Hokkaido
Feudal Japan

During the Muromachi period (1336–1573), the Japanese established a settlement at the south of the Oshima Peninsula, with a series of fortified residences such as that of Shinoridate. As more people moved to the settlement to avoid battles, disputes arose between the Japanese and the Ainu. The disputes eventually developed into war. Takeda Nobuhiro (1431 – 1494) 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, who had extensive trading networks. The Matsumae held authority over the south of Ezochi until the end of the Edo period.

The Matsumae clan rule over the Ainu must be understood in the context of the expansion of the Japanese feudal state. Medieval military leaders in northern Honshu (ex. Northern Fujiwara, Akita clan) maintained only tenuous political and cultural ties to the imperial court and its proxies, the Kamakura shogunate and Ashikaga shogunate. Feudal strongmen sometimes defined their own roles within the medieval institutional order, taking shogunate titles, while in other times they assumed titles that seemed to give them a non-Japanese identity. In fact, many of the feudal strongmen were descended from Emishi military leaders who had been assimilated into Japanese society. The Matsumae clan were of Yamato descent like other ethnic Japanese people, whereas the Emishi of northern Honshu were a distinctive group related to the Ainu. The Emishi were conquered and integrated into the Japanese state dating back as far as the 8th century and as result began to lose their distinctive culture and ethnicity as they became minorities. By the time the Matsumae clan ruled over the Ainu, most of the Emishi were ethnically mixed and physically closer to Japanese than they were to Ainu. From this, the "transformation" theory postulates that native Jōmon peoples changed gradually with the infusion of Yayoi immigrants into the Tōhoku region of northern Honshu, in contrast to the "replacement" theory that posits the Jōmon was replaced by the Yayoi.

There were numerous revolts by the Ainu against feudal rule. The last large-scale resistance was Shakushain's revolt in 1669–1672. In 1789, a smaller movement known as the Menashi–Kunashir rebellion was crushed. After that rebellion, the terms "Japanese" and "Ainu" referred to clearly distinguished groups, and the Matsumae were unequivocally Japanese.

According to John A. Harrison of the University of Florida, prior to 1868 Japan used proximity as its claim to Hokkaido, Saghalien and the Kuril Islands; however, Japan had never thoroughly explored, governed, or exploited the areas, and this claim was invalidated by the movement of Russia into the Northeast Pacific area and by Russian settlements on Kamchatka (from 1699), Sakhalin (1850s) and the Sea of Okhotsk Coast (1640s onwards).

Prior to the Meiji Restoration of 1868, the Tokugawa shogunate realized the need to prepare northern defenses against a possible Russian invasion and took over control of most of Ezochi in 1855-1858. Many Japanese settlers regarded the Ainu as "inhuman and the inferior descendants of dogs". The Tokugawa irregularly imposed various assimilation programs on the Ainu due to the Tokugawa's perception of a threat from Russia. For example, assimilation programs were implemented in response to perceived threats from Russia, which included the Laxman expedition of 1793 and the Golovnin Incident of 1804. Once the respective Russian threats appeared to subside, the assimilation programs were halted until 1855. However, in 1855, once the Treaty of Shimoda was signed, which defined the borders between Russian Empire and Tokugawa Japan, the Tokugawa again viewed Russia as a threat to Japanese sovereignty over Hokkaido, and reinstated assimilation programs on the Ainu.
punctuation:no_comma