Spanish East Indies together with the Spanish West Indies, were administered through the Viceroyalty of New Spain based in Mexico City. After Mexican independence, they were ruled directly from Madrid. As a result of the Spanish–American War in 1898, the Philippines and Guam were occupied by the United States while about 6,000 of the remaining smaller islands were sold to Germany in the German–Spanish Treaty of 1899. The few remaining islands were ceded to the United States when the Treaty of Washington was ratified in 1901. Spanish contact began on , when a Spanish expedition led by Ferdinand Magellan reached the Mariana Islands.
Dutch East Indies privileged upper social class of soldiers, administrators, managers, teachers and pioneers. They lived together with the "natives", but at the top of a rigid social and racial caste system. The Dutch East Indies had two legal classes of citizens; European and indigenous. A third class, Foreign Easterners, was added in 1920. In 1901 the Dutch adopted what they called the Ethical Policy, under which the colonial government had a duty to further the welfare of the Indonesian people in health and education. Other new measures under the policy included irrigation programs, transmigration, communications, flood mitigation, industrialisation, and protection of native