In the 19th century, international attention to Shanghai grew due to European recognition of its economic and trade potential at the Yangtze. During the First Opium War (1839–1842), British forces occupied the city. The war ended in 1842 with the Treaty of Nanking, which opened Shanghai as one of the five treaty ports for international trade. The Treaty of the Bogue, the Treaty of Wanghia, and the Treaty of Whampoa (signed in 1843, 1844, and 1844, respectively) forced Chinese concession to European and American desires for visitation and trade on Chinese soil. Britain, France, and the United States all carved out outside the walled city of Shanghai, which was still ruled by the Chinese.