After further attempts, Palau islands were made part of the Spanish East Indies in 1885. Following Spain's defeat in the Spanish–American War in 1898, the islands were sold to Imperial Germany in 1899 under the terms of the German–Spanish Treaty, where they were administered as part of German New Guinea. British traders became prominent visitors in the 18th century, followed by expanding Spanish influence in the 19th century. Following its defeat in the Spanish–American War, Spain sold Palau and most of the rest of the Caroline Islands to Germany in 1899. Control passed to Japan in 1914 and during World War II the islands were taken by the United States in 1944, with the costly Battle of Peleliu between September 15 and November 25 with more than 2,000 Americans and 10,000 Japanese killed. The islands passed formally to the United States under United Nations auspices in 1947 as part of the Trust Territory of the Pacific Islands.