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 Empire
With the conquest and settlement of the Philippines, the Spanish Empire reached its greatest extent. In 1564, Miguel López de Legazpi was commissioned by the viceroy of New Spain (Mexico), Don Luis de Velasco, to lead an expedition in the Pacific Ocean to find the Spice Islands, where earlier explorers Ferdinand Magellan and Ruy López de Villalobos had landed in 1521 and 1543, respectively. The westward sailing to reach the sources of spices continued to be a necessity with the still Ottomans controlling major choke points in central Asia. It was unclear how the agreement between Spain and Portugal dividing the Atlantic world affected finds on the other side of the Pacific. Spain had ceded its rights to the "Spice Islands" to Portugal in the Treaty of Saragossa in 1529, but the appellation was vague as was their exact delineation. The Legazpi expedition was ordered by King Philip II, after whom the Philippines had earlier been named by Ruy López de Villalobos, when Philip was heir to the throne. The king stated that "the main purpose of this expediiton is to establish the return route from the western isles, since it is already known that the route to them is fairly short." The viceroy died in July 1564, but the Audiencia and López de Legazpi completed the preparations for the expedition. On embarking on the expedition, Spain lacked maps or information to guide the king's decision to authorize the expedition. That realization subsequently led to the creation of reports from the various regions of the empire, the relaciones geográficas. The Philippines came under the jurisdiction of the viceroyalty of Mexico, and once the Manila Galleon sailings between Manila and Acapulco were established, Mexico became the Philippines' link to the larger Spanish Empire.