During the nineteenth century the major European powers compelled the reluctant Chinese Empire to start trading with them. There was little the Chinese government wanted from the West at the time but there was a strong demand for opium among the population. In the Opium Wars of 1839-1842 and 1856-1860, the British forced the Chinese to accept the import of opium in return for Chinese goods, and trading centres were established at major ports. The largest of these was Shanghai, where French, German, British, and American merchants demanded large tracts of land in which they asserted "extra-territorial" rights - being subject to the laws of their own country rather than Chinese law. According to popular myth, a sign at Huangpu Park near a European compound read: "No dogs or Chinamen". The Chinese government's failure to resist inroads on its sovereignty and withstand further demands from the Europeans, such as the right to build railways and other concessions, caused much resentment among large sections of the population. This eventually led to the Chinese revolution of 1911 which toppled the imperial dynasty.
By the end of the nineteenth century the balance of the lucrative trade between China and merchants from America and Europe, particularly Britain, lay almost entirely in the West's favour. As Western influence increased, anti-European secret societies began to form. Among the most violent and popular was the I-ho-ch'uan (the Righteous and Harmonious Fists). Christian missionaries were probably the first to refer to the well-trained, athletic young men as "Boxers", because of the martial arts they practiced, and so the society gave the Boxer Rebellion its name.
Throughout 1899 the I-ho-ch'uan and other militant societies combined in a campaign against Westerners and Westernised Chinese. Missionaries and other civilians were killed, women were raped, and European property was destroyed. By March 1900 the uprising spread beyond the secret societies and Western powers decided to intervene, partly to protect their nationals, but mainly to counter the threat to their territorial and trade ambitions.