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).
Military history of Spain
After Christopher Colombus's successful navigation to the New World under Spanish patronage, Spanish forces rapidly began to occupy much of the new territories, rapidly taking the Bahamas and defeating the local Arawak speaking indigenous groups. The efforts of Ferdinand Magellan, reaching the island of Limasawa in 1521, led to the subsequent establishment of the colony of the Philippines under Miguel López de Legazpi which was to become an essential Spanish military base in the Pacific. The challenge of the Barbary Pirates encouraged defensive and punitive expeditions across the Mediterranean, resulting in the conquest of various outposts in North Africa, including Melilla in 1497, Mazalquivir in 1505, Oran in 1509, Algiers in 1510, Tripoli in 1511 and the smaller Plazas de Soberania.