 Before colonization (1843), Shanghai culture was mainly influenced and shaped by the ancient kingdoms of Wu and Yue (districts of now Jiangsu and Zhejiang Provinces).Following the defeat of China in the First Opium War by the British Empire, several ports were opened to foreign trade including Shanghai.After the issue of Nanjing Treaty in 1843, small enclaves were formed and ruled by foreign settlements (see picture).