Foreign relations of imperial China

The foreign relations of Imperial China from the Qin dynasty until the Qing dynasty encompassed many situations as the fortunes of dynasties rose and fell. Chinese culture had influenced neighboring and distant countries, while being transformed by outside influences as well as being conquered. During the Western Han dynasty, the Silk Road trade routes were established and brought Hellenistic Central Asia, Persia under the Parthian Empire, and South Asia into contact with the Chinese empire. During the 2nd century BC, Zhang Qian became the first known Chinese diplomat to venture deep into Central Asia in search of allies against the Mongolic Xiongnu confederation. Han Chinese attempts were made at reaching the Roman Empire and although the mission led by Gan Ying in 97 AD was a failure, Chinese historical records nevertheless maintain that the Romans traveled to southern China and Vietnam via the Indian Ocean. Buddhism from India was introduced to China during the Eastern Han period and would spread to neighboring Vietnam, Korea, and Japan, all of which would adopt similar Confucian cultures based on the Chinese model.

Following the fall of Sasanian Persia to the Rashidun Caliphate, Chinese contacts with the Islamic world were initiated during the Tang dynasty. Foreign faiths entered China at this time, such as Zoroastrianism, Nestorian Christianity and Islam, although Chinese Buddhism and Taoism remained prominent. The Song dynasty dealt on a basis of equality with the neighboring Liao and Jin dynasties until falling to the Mongol conquest. The Mongol Empire became the dominant state in Asia, and the Pax Mongolica encouraged trade of goods, ideas, and technologies from east to west during the early and mid-13th century. Marco Polo could safely travel back and forth, for instance. The Mongol-led Yuan dynasty founded by Kublai Khan ruled from the capital of Khanbaliq (modern Beijing). The Yuan dynasty's failed diplomacy with the Kamakura Shogunate of Japan led to the Mongol invasions of Japan, which also ended in failure for the Yuan Empire.

Following the collapse of the Yuan dynasty and the formation of the Ming dynasty by the Hongwu Emperor in 1368, imperial Chinese power was projected abroad with the 15th-century Chinese treasure fleet of Admiral Zheng He. As representatives of the Yongle Emperor, Zheng's fleet sailed throughout Southeast Asia, the Indian Ocean and to East Africa exacting tribute, granting lavish gifts to vassal states, and even invaded Sri Lanka. However, the fleet was later dismantled and the Ming emperors thereafter fostered Haijin isolationist policies that limited international trade and foreign contacts to a handful of seaports and other locations. These policies saw a gradual reversal after the arrival of European explorers such as Jorge Álvares (the first foreigner to travel to China by sea) and Rafael Perestrello and, although a war was initially fought against the Portuguese Empire, the Portuguese were granted a colonial settlement at Macau in the 16th century. Catholic Jesuit missions in China were also introduced, with Matteo Ricci being the first European allowed to enter the Forbidden City of the Ming emperors in Beijing. During the subsequent Qing dynasty Jesuits from Europe such as Giuseppe Castiglione gained favor at court until the Chinese Rites controversy and most missionaries were expelled in 1706.

The dissolution of the Mongol empire in the fourteenth century made Central Asian trade routes dangerous and forced Western European powers to explore ocean routes. European powers, including the Portuguese, Spanish and Dutch began trading with China in the early 17th century. The Qing court moved to control this burgeoning trade with the Europeans by creating the Canton System in 1756, granting a monopoly of trade to the merchants of the Thirteen Factories and restricted it to Canton (as Guangzhou was then known) in the south. The British Macartney Embassy of 1793 failed to convince the Qianlong Emperor to open northern Chinese ports for foreign trade or establish direct relations. Britain's growing importation of Chinese goods such as tea was offset by their illicit sale of opium to Chinese smugglers. However, the Qing unilateral banning of the sale of opium led to the Opium Wars and Chinese defeat. The 1842 Treaty of Nanking replaced the Canton system with a series of treaty ports, ending the tributary system as well.