Major military efforts were taken by Kublai Khan of the Yuan dynasty in 1274 and 1281 to conquer the Japanese archipelago after the submission of the Korean kingdom of Goryeo to vassaldom. Ultimately a failure, the invasion attempts are of macro-historical importance because they set a limit on Mongol expansion and rank as nation-defining events in the history of Japan. The invasions are referred to in many works of fiction and are the origin of the word kamikaze (神風 "divine wind"), first used to describe the typhoons that destroyed the Mongol invasion fleets in the 13th century. The term was later adopted in the 20th century to describe Japanese pilots who deliberately crashed their aircraft into enemy warships during the last years of World War II.
The invasions were one of the earliest cases of gunpowder warfare outside of China. One of the most notable technological innovations during the war was the use of explosive, hand-thrown bombs.
After a series of Mongol invasions of Korea between 1231 and 1281, Goryeo signed a treaty favouring the Mongols and became a vassal state. Kublai was declared Khagan of the Mongol Empire in 1260, although it was not widely recognized by the Mongols in the west, and established his capital at Khanbaliq (now in Beijing) in 1264.
Japan was then ruled by the Shikken (shogunate regents) of the Hōjō clan, who had intermarried with and wrested control from Minamoto no Yoriie, shōgun of the Kamakura shogunate, after his death in 1203. The inner circle of the Hōjō clan had become so pre-eminent that they no longer consulted the council of the shogunate (Hyōjō (評定)), the Imperial Court of Kyoto, or their gokenin vassals, and they made their decisions at private meetings in their residences (yoriai (寄合)).
The Mongols also made attempts to subjugate the native peoples of Sakhalin, the Ainu and Nivkh peoples, from 1264 to 1308. However, it is doubtful if Mongol activities in Sakhalin were part of the effort to invade Japan.
Between 1266 and 1273, Mongol and Korean diplomatic missions went to Japan on six occasions to demand submission to the Mongols, but the Japanese ignored their demands.
In 1265, a well-traveled Goryeo citizen told Kublai that the Mongols should bring Japan to vassalage. Kublai agreed and named Heuk Chŭk and Eun Hong as envoys to Japan. They were ordered to go to Goryeo and request that the king appoint an additional envoy to join them. They delivered this message to Wonjong and two of his officials, Son Gunbi and Kim Chan, were appointed to join them on their journey. On their departure, they were met by a storm, and the Mongol envoys were forced to return home. Kublai was unsatisfied with the outcome and sent Heuk Chŭk back ordering Wonjong to forward the Mongol envoys to Japan.
Yi Changyong, a senior Goryeo minister, attempted to dissuade the Mongols from their plans on Japan. Kublai sent a general, Uya Sondal, to demand that Yi Changyong and Kim Chun, head of the Goryeo military regime, the two most influential officials of Goryeo, be brought to the Yuan court. Instead, Kim had Sondal put to death. This frightened Wonjong, who didn't want to offend the Mongols, but he dared not lay a hand on Kim. Having gone unpunished, Kim and his family began to disrespect the king. Wonjong and Im Yŏn, an official who hated Kim, summoned him to court and killed him.
The Mongol and Goryeo envoys ultimately reached Japan but were treated with incredible disrespect. They were not permitted to enter the capital city, and the Japanese refused to give them lodgings worthy of foreign dignitaries. Instead, they were forced to stay at an inn called Tajabu outside the west gate of the city. They remained there for five months with poor entertainment and bad accommodations before being dismissed without receiving an answer. Kublai could not believe that his envoys had been treated with such disrespect and suspected that this was a ruse by Wonjong, so he sent Heuk Chŭk back to Japan, this time accompanied by the Goryeo envoy, Sim Sa-jŭn. The envoys had not returned by 1268 but ultimately left after their letter was rejected by the Japanese.
The Emperor of the Great Mongols, being commissioned by Heaven, hereby respectfully presents a letter to the King of Japan. From time immemorial rulers of small states, the borders of which closely adjoin, have always endeavoured to maintain friendly relations with each other and have manifested mutual respect and trust. On our part, we, from the time of our forefathers, have received the Mandate of Heaven and have ruled the universe. Innumerable people in far-off lands have learned to fear our power and have longed for our virtuous rule. When we first ascended the throne, the innocent and helpless people of Korea had suffered for long from military struggles. We therefore ordered a cessation of hostilities, restored their land, and returned the captive Koreans, young and old.In gratitude both ruler and people of Korea now present themselves at our court. Although the legal relation between ourselves and the Koreans is that of sovereign and subjects, yet in feeling we are as father and children. We assume that Your Highness and your subjects have known this. Korea is our eastern tributary state. Japan is located near to Korea and since her founding has time and again established relations with the Middle Kingdom. However, since our accession you have not yet sent an envoy to our court; nor have you indicated a desire to establish friendly relations with us. We are afraid this is because Your Kingdom has not yet been well informed of this. Therefore we now send a special envoy bearing our state papers to inform you of our desire. We hope that henceforth you will enter into friendly relations with us, and that both our people and yours will enjoy peace and harmony. Moreover, the sages consider the entire universe one family. Therefore, if we should not establish friendly relations with each other, how could it be in accordance with the doctrine of one family? Who would care to appeal to arms?I hereby leave the matter to Your Highness's careful consideration.
In early 1269, another mission of 70 Koreans and Mongols arrived on Tsushima Island, demanding an answer from Japan to the khagan's letter. The imperial court wanted to respond, but the Kamakura shogunate overruled them. A defiant response to the khagan's demands was drafted but ultimately not delivered.
In late 1270, a final mission was dispatched by Kublai to Japan. The mission was led by the Yuan official Zhao Liangbi and comprised 24 scribes. By now, the Japanese were tired of Mongol entreaties. Upon their arrival in early 1271, the delegation was confronted by armed samurai and taken into military custody. Zhao was freed, but he was denied an audience with the "king of Japan". After delivering their letter and receiving no reply, they went home. Zhao waited for a response until 1273 before returning to China. Irritated and angry, he composed a report for Kublai denigrating the Japanese as mannerless barbarians and urged him not to waste the empire's resources conquering them.
Japan took seriously the letter brought by the second diplomatic mission to Japan in 1268 as an omen of invasion; shrines and temples were instructed to pray for the repulsion of foreign troops and the central government suspended most of its regular duties to focus on building up defenses around Kyushu.
In April 1274, the Yuan instructed Indü and Hong Dagu to mobilize 15,000 men for the invasion of Japan. The Korean general Kim Panggyong led a force of 30,500 to build ships in the fashion of the Southern Chinese. A man from Shandong named Qi Gongzhi who helped Kublai design ships was ordered to Korea where he spent a few months before being sent to Xiangyang for the invasion of southern China. Three types of ships were constructed: 300 large thousand dan ships, 300 batulu fast boats, and 300 tenders. Hong Dagu was put in charge of the construction of large transports while Chaqu supervised the construction of the batulu fast boats. Goryeo was responsible for providing the labor, material, and cost of the construction, which they protested. The construction was finished on 5 July 1274. The invasion fleet was scheduled to depart in the seventh lunar month of 1274 but was delayed for three months due to the death of Wonjong on 23 July and Indü and Liu Fuheng's tardiness. They did not arrive until September.