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
French and British interregnum in the Dutch East Indies in Malaccan strait, the island of Singapore and Penang. As the British coveted the Dutch colonies in the region, the French-controlled East Indies was bracing for the predicted incoming British invasion. In 1806, King Lodewijk Napoleon of the Netherlands sent one of his general, Herman Willem Daendels, serving as governor-general of East Indies based in Java. Daendels was sent to strengthen Javanese defences against a perceived incoming British invasion. He arrived in the city of Batavia (now Jakarta) on 5 January 1808 and relieved the former Governor General, Albertus Wiese. He raised new forces, built new roads within Java, and