influx of new smugglers was greatly alarming the Chinese but were unable to rein them in before the viceroy Lin Zexu placed the foreign factories under complete blockade, demanding the surrender of all opium held in the Pearl River Delta. The British were only able to provide it after their superintendent guaranteed to indemnify the loss. The sum turned out to be so large (£3,000,000) that it prompted the First Opium War, The 1842 Treaty of Nanking – the beginning of the unequal treaties that restricted Qing sovereignty in the 19th century – is generally taken to have ended China's isolation, with the opening of the ports of Xiamen ("Amoy"), Fuzhou ("Fuchow"), Ningbo ("Ningpo"), and Shanghai, but legal trade continued to be limited to specified ports until the end of the dynasty. Nonetheless, the war began a pattern of war, defeat, concessions, and reparations, further weakening the Chinese government and economy through the outflow of silver. Anger at Qing concessions and surprise at their weakness was already prompting rebellions before disastrous flooding in the early 1850s – inter alia, shifting the mouth of the Yellow River from south of the Shandong peninsula to north of it – ruined and dislocated millions. In 1851, Hong Xiuquan began a revolt against the Qing dynasty, proclaiming its rulers to be "filthy barbarians and beasts" who had "led China into despair". His Taiping Rebellion quickly took control of much of southeastern China. With aid from the British and French, the Qing defeated the rebels, but at an ultimate cost of over 20 million lives. Lasting until 1871, the Taiping Rebellion was one of the bloodiest wars in history and devastated the Qing economy, which had not been helped by the outbreak of a Second Opium War in 1856. At the same time, unrest in the Altishahr and Tarim Basin areas of Xinjiang in China's far north west proved a further drain on the imperial treasury. The maintenance of army garrisons to maintain order in Xinjiang and its adjunct administration cost tens of thousands of taels of silver annually, which required subsidies from agricultural taxes levied in the wealthier provinces. Following the Taiping Rebellion, some Manchu nobles acknowledged that reforms were necessary. They instituted the Self-Strengthening Movement, which undertook limited modernizations primarily aimed at China's military industry. The army was reequipped and a modern standing navy developed. Most of the Manchu nobility opposed these developments,