Under the Ming and the Qing, people from other countries could only buy and sell things with China on an island near Guangzhou. The British began selling Indian drugs to pay for all the tea and other things they were buying from China. In the 1840s, China tried to stop them and the British started a war. To keep them from hurting Nanjing, the Chinese agreed to let them keep selling drugs. They also let the British start buying and selling things at four other cities, including Shanghai. Soon, parts of Shanghai were controlled by the UK, the US, and France. This control was ended by the Japanese during World War II.