The viceroy Lin Zexu's vigorous suppression of the British opium trade precipitated the First Opium War (1839–42), during which the factories were burnt to the ground. The 1842 Treaty of Nanking ending that war forced the ceding of Hong Kong Island to the British and opened the treaty ports of Shanghai, Ningbo ("Ningpo"), Xiamen ("Amoy"), and Fuzhou ("Fuchow"). It nominally opened the walled city of Guangzhou to the foreigners, but this was subsequently resisted by the city's viceroys on a number of pretexts. The factories were rebuilt at their former location but, with their diminished importance, they were not rebuilt a third time after their destruction at the onset of the Second Opium War. Instead, the foreign traders first operated off of Henan Island on the other side of the Pearl River and then, after the war's conclusion, rebuilt their Guangzhou operations at a new enclave on the Shamian sandbar south of the city's western suburbs.