Spanish East Indies exception of a short period at the end of the 18th century). In 1821 the New Spanish Viceroyalty collapsed following the Mexican War of Independence, which resulted in the First Mexican Empire. All control of the Spanish East Indies government was then transferred to Madrid, until the United States annexed most Spanish territories in the Asia-Pacific region after the Spanish–American War of 1898. In 1574 the Captaincy General of the Philippines was created as a dependency of the Viceroyalty of New Spain. The Real Audiencia of Manila was created on and established in 1584 as the highest tribunal of the
Spanish East Indies of Luzon remained outside Spanish control until the early 19th century, and the southernmost tip of Palawan, not until the late 1890s. The rest of Mindanao (Caesarea Karoli)—aside from outposts in Northern Mindanao, Zamboanga, Cotabato, and the islands of Basilan and Jolo, the rest was nominally under Spanish control, recognizing Spanish rule, but left to administer their own affairs, as in the cases of the Sulu, and the Maguindanao sultanates, as well as a number of other Lumad tribes not affiliated with either. Similarly, Palau and the vast majority of the Caroline Islands were not governed by Spanish missions until