In 1929 the Nationalist government announced its goal of ending extraterritoriality. Negotiations with Britain, the main holder of such rights, went slowly. They ended ended with the Japanese invasion of 1937, as Japan seized Shanghai and the main treaty ports where extraterritoriality was in operation. When Britain and the United States went to war with Japan in late 1941, they became formal allies of China and made ending extraterritoriality an urgent goal. The United States focused on protecting its immigration restrictions. Britain sought and failed to secure guarantees for the freedom of its commerce. Both the U.S. and Britain relinquished extraterritorial rights with new treaties in 1943: the Sino-American Treaty for the Relinquishment of Extraterritorial Rights in China and the Sino-British Treaty for the Relinquishment of Extra-Territorial Rights in China. Other countries quickly followed