Brunei
War with Spain and decline

Brunei briefly rose to prominence in Southeast Asia when the Portuguese occupied Malacca and thereby forced the wealthy and powerful but displaced Muslim refugees there to relocate to nearby Sultanates such as Brunei. The Bruneian Sultan then intervened in a territorial conflict between Hindu Tondo and Muslim Manila in the Philippines by appointing the Bruneian descended Rajah Ache of Manila as admiral of the Bruneian navy in a rivalry against Tondo and as the enforcer of Bruneian interests in the Philippines. He subsequently encountered the Magellan expedition wherein Antonio Pigafetta noted that under orders from his grandfather the Sultan of Brunei, Ache had previously sacked the Buddhist city of Loue in Southwest Borneo for being faithful to the old religion and rebelling against the authority of Sultanate. However, European influence gradually brought an end to Brunei's regional power, as Brunei entered a period of decline compounded by internal strife over royal succession. In the face of these invasions by European Christian powers, the Ottoman Caliphate aided the beleaguered Southeast Asian Sultanates by making Aceh a protectorate and sending expeditions to reinforce, train and equip the local mujahideen. Turks were routinely migrating to Brunei as evidenced by the complaints of Manila Oidor Melchor Davalos who in his 1585 report, say that Turks were coming to Sumatra, Borneo and Ternate every year, including defeated veterans from the Battle of Lepanto.

Spain declared war in 1578, planning to attack and capture Kota Batu, Brunei's capital at the time. This was based in part on the assistance of two Bruneian noblemen, Pengiran Seri Lela and Pengiran Seri Ratna. The former had travelled to Manila, then the centre of the Spanish colony. Manila itself was captured from Brunei, Christianised and made a territory of the Viceroyalty of New Spain which was centered in Mexico City. Pengiran Seri Lela came to offer Brunei as a tributary to Spain for help to recover the throne usurped by his brother, Saiful Rijal. The Spanish agreed that if they succeeded in conquering Brunei, Pengiran Seri Lela would be appointed as the sultan, while Pengiran Seri Ratna would be the new Bendahara.

In March 1578, a fresh Spanish fleet had arrived from Mexico and settled at the Philippines. They were led by De Sande, acting as Capitán-General. He organized an expedition from Manila for Brunei, consisting of 400 Spaniards and Mexicans, 1,500 Filipino natives, and 300 Borneans. The campaign was one of many, which also included action in Mindanao and Sulu. The racial make-up of the Christian side was diverse since it were usually made up of Mestizos, Mulattoes and Amerindians (Aztecs, Mayans and Incans) who were gathered and sent from Mexico and were led by Spanish officers who had worked together with native Filipinos in military campaigns across the Southeast Asia. The Muslim side was also equally racially diverse. In addition to the native Malay warriors, the Ottomans had repeatedly sent military expeditions to nearby Aceh. The expeditions were composed mainly of Turks, Egyptians, Swahilis, Somalis, Sindhis, Gujaratis and Malabars. These expeditionary forces had also spread to other nearby Sultanates such as Brunei and had taught new fighting tactics and techniques on how to forge cannons.

Eventually, the Spanish captured the capital on 16 April 1578, with the help of Pengiran Seri Lela and Pengiran Seri Ratna. The Sultan Saiful Rijal and Paduka Seri Begawan Sultan Abdul Kahar were forced to flee to Meragang then to Jerudong. In Jerudong, they made plans to chase the conquering army away from Brunei. Suffering high fatalities due to a cholera or dysentery outbreak, the Spanish decided to abandon Brunei and returned to Manila on 26 June 1578, after 72 days.

Pengiran Seri Lela died in August or September 1578, probably from the same illness suffered by his Spanish allies. There was suspicion that the legitimist sultan could have been poisoned by the ruling sultan. Seri Lela's daughter, a Bruneian princess, "Putri", had left with the Spanish, she abandoned her claim to the crown and then she married a Christian Tagalog, named Agustín de Legazpi de Tondo. Agustin de Legaspi along with his family and associates were soon implicated in the Conspiracy of the Maharlikas, an attempt by Filipinos to link up with the Brunei Sultanate and Japanese Shogunate to expel the Spaniards from the Philippines. However, upon the Spanish suppression of the conspiracy, the Bruneian descended aristocracy of precolonial Manila were exiled to Guerrero, Mexico which consequently later became a center of the Mexican war of independence against Spain.

The local Brunei accounts of the Castilian War differ greatly from the generally accepted view of events. What was called the Castilian War was seen as a heroic episode, with the Spaniards being driven out by Bendahara Sakam, purportedly a brother of the ruling sultan, and a thousand native warriors. Most historians consider this to be a folk-hero account, which probably developed decades or centuries after.

Brunei eventually descended into anarchy. The country suffered a civil war from 1660 to 1673.
punctuation:no_comma, detectable_format:multiple_sections[4], detectable_content:number_placeholders[6]