The Shanghai International Settlement originated from the 1863 merger of the British and American enclaves in Shanghai, in which British and American citizens would enjoy extraterritoriality and consular jurisdiction under the terms of unequal treaties agreed by both parties. These treaties were abrogated in 1943.
The British settlements were established following the victory of the British in the First Opium War (1839–1842). Under the terms of the Treaty of Nanking, the five treaty ports including Shanghai were opened to foreign merchants, overturning the monopoly then held by the southern port of Canton (Guangzhou) under the Canton System. The British also established a base on Hong Kong. American and French involvement followed closely on the heels of the British and their enclaves were established north and south, respectively, of the British area.