Spanish–Moro conflict
The Spanish initiated the conflict by conquering the Philippines and invading Moro territory in an effort to subjugate the region to their rule since the 1500s. When the Spanish conquered the Muslim Kingdom of Maynila, a vassal of the Sultanate of Brunei, the Islamic rajah, Rajah Sulayman resisted the Spanish. Manila then became the capital of the Spanish Philippines after the conquest, with the Spanish forcibly converting people to Catholicism. The Spanish–Moro Wars started with the Castille War, a war between Spaniards and the Sultanate of Brunei. (The term "Moro" at this time included Muslim Tagalogs who were ruled by the Sultanate of Brunei).
Spanish East Indies
Seeking to develop trade between the East Indies and the Americas across the Pacific Ocean, Antonio de Mendoza encouraged the exploration of these Asian territories and commissioned the expedition of Ruy López de Villalobos to the Philippines in 1542–1543. Miguel López de Legazpi set out from Mexico, and established the first Spanish settlement in the Philippines in 1565, which became the town of San Miguel in present-day Cebu. That same year, another member of the expedition, Andrés de Urdaneta discovered a maritime route from the Philippines to Mexico, across the Pacific, leading to the important transpacific trade link of the Manila-Acapulco Galleons. In 1571, Manila was captured from the Sultanate of Brunei and then Manila was made the seat of the Spanish Captaincy General of the Philippines. These and other Asian territories claimed by the Spanish crown were to be governed from the Viceroyalty of New Spain in Mexico City.