History of Brunei

The history of Brunei concerns the settlements and societies located on the north coast of the island of Borneo, which has been under the influence of Indianised kingdoms and empires for much of its history. Local scholars assume that the Islamisation of Brunei started in the fifteenth century, with the formation of the Bruneian Empire, a thalassocracy which covered the northern part of Borneo and the southern Philippines. At the end of the 17th century, Brunei subsequently entered a period of decline brought on by Brunei Civil War, piracy, and European colonial expansion. Later, there was a brief war with Spain, in which Brunei lost Manila and evacuated their capital for a brief period until the Spanish withdrew. The empire lost much of its territory with the arrival of the Western powers, such as the Spanish in the Philippines and the British in Labuan, Sarawak, and North Borneo. The decline of the Bruneian Empire accelerated in the nineteenth century when Brunei gave much of its territory to the White Rajahs of Sarawak, resulting in its current small landmass and separation into two parts. Sultan Hashim Jalilul Alam Aqamaddin later appealed to the British to stop further annexation in 1888. In the same year, the British signed a "Treaty of Protection" and made Brunei a British protectorate until 1984 when it gained independence and prospered due to the discovery of oil.
Pre-Islamic Hindu-Buddhist Indianised kingdoms.
The history of Brunei before the arrival of Magellan's ships in 1519-1522 CE is based on speculation, the interpretation of Chinese sources, and local legends. Excavations unearthed near Bandar Seri Begawan suggest that the Chinese may have traded in the area as early as 835 AD. Camphor and pepper seem to have been prized objects of trade. Brunei hard camphor had a wholesale value equivalent to its own weight in silver. Ming dynasty accounts give detailed information about visits and tribute missions by rulers of P'o-ni (transliteration of "Bumi") during the late fourteenth and early fifteenth century. Their names and titles suggest either Hindu or Buddhist influence. The texts confirm that the state was tributary to the Hindu Javanese Majapahit Empire, but sought and received Chinese protection in 1408.
Syair Awang Semaun.
According to the official version of events mainly the national epic poem Syair Awang Semaun, Brunei was founded by a band of fourteen saudara (brothers and first cousins), who eventually settled in the Brunei river near the present capital and chose one of their number as the first ruler. Some known versions of the Syair Awang Semaun state that they were all the sons of Dewa Amas of Kayangan, a part supernatural being who descended to earth at Ulu Limbang in an egg. Discovered by the Sang Aji, he was married to that ruler's daughter by whom he fathered one son. He travelled to thirteen settlements in the region in search of an auspicious ox. At each of the villages, he fathered thirteen (or twenty-two) other sons by thirteen different aboriginal wives, daughters of the local penghulu.
The first ruler chosen by the saudara to rule the newly founded state was Awang Alak Betatar, the son of Dewa Amas and the Sang Aji's daughter. He was not necessarily the eldest among them, but chosen to rule because of his fitness to do so. The official account states that he journeyed to Johor, embraced Islam, married the daughter of a Sultan "Bahkei" of Johor and received the title of Sultan Muhammad Shah from him.
The Nunuk Ragang Connection.
Later this staging station became the permanent settlement now known as Nunuk Ragang the original home of the Kadazan-Dusun race. At the staging station the Chinese hung red colored pieces of fabric and red colored banner to indicate their presence to any follow-up parties. Red is an important symbolic color in Chinese culture, and even today whenever the Chinese set up a new project such as land development, they never neglect to set up a red coloured altar and offer sacrifice. There is no zoological record of a red coloured Banyan Tree so it can only be assumed that to the simple native mind the Banyan tree has turned red, hence the name Nunuk Ragang. Additionally, the local native women were themselves descendants of previous waves of migrations of Austronesian people from mainland China and Taiwan to Sahul. Meanwhile, the settlement at Nunuk Ragang had already been well established and thriving. The new Raja, having converted to Islam was no longer interested in Jewell and dragon, but more concerned with court affairs having been appointed an important adviser to the Brunei Sultanate. Trading in the abundant resources at Kinabatangan became his most primary concern and the men at Nunuk Ragang was abandoned and left to fend for themselves.
Relations with Europeans.
Brunei's relations varied with the different European powers in the region. The Portuguese, for the most part, were more interested in economic and trading relations with the regional powers and did little to interfere with Brunei's development. This does not mean that relations were always cordial, such as in 1536 when the Portuguese attacked the Muslims in the Moluccas and the ambassador to the Brunei court had to leave because of the sultan's hostility. The Portuguese also noted that the sultanate was heavily involved in the region's politics and wars, and that Brunei merchants could be found in Ligor and Siam.
Relations with Spain were far more hostile. From 1565 on, Spanish and Brunei forces engaged in a number of naval skirmishes, and in 1571 the Spanish who had been sending expeditions from Mexico succeeded in capturing Manila from the Brunei aristocracy that had been established there. Brunei raised several large fleets with the intention of recapturing the city, but the campaigns, for various reasons, never launched. In 1578, the Spanish took Sulu and in April attacked and captured Brunei itself, after demanding that the sultan cease proselytising in the Philippines and, in turn, allow Christian missionaries to be active in his kingdom. The Spaniards withdrew after suffering heavy losses due to a cholera or dysentery outbreak. They were so weakened by the illness that they decided to abandon Brunei to return to Manila on 26 June 1578, after just 72 days. The short-term damage to the sultanate was minimal, as Sulu regained its independence soon after. However, Brunei failed to regain a foothold in Luzon, with the island firmly in Spanish hands.
The long-term effects of regional changes could not be avoided. After Sultan Hassan, Brunei entered a period of decline, due to internal battles over royal succession as well as the rising influences of European colonial powers in the region, that, among other things, disrupted traditional trading patterns, destroying the economic base of Brunei and many other Southeast Asian sultanates.
Relationship with the British and Sarawak.
During Sultan Omar Ali Saifuddin II’s reign, disturbances occurred in Sarawak. In 1839, the British adventurer James Brooke arrived in Borneo and helped the Sultan put down this rebellion.
As a reward, he became governor and later "White Rajah" of Sarawak and gradually expanded the territory under his control. Brooke never gained control of Brunei, though he did attempt to. He asked the British to check whether or not it would be acceptable for him to claim Brunei as his own; however, they came back with bad news—although Brunei was poorly governed, it had a definite sense of national identity and could therefore not be absorbed by Brooke.
In 1843 an open conflict between Brooke and the Sultan ended in the latter's defeat. The Sultan recognised Sarawak's independence. In 1846, Brunei Town was attacked and captured by the British and Sultan Saifuddin II was forced to sign a treaty to end the British occupation of Brunei Town. In the same year, Sultan Saifuddin II ceded Labuan to the British under the Treaty of Labuan. In 1847, he signed the Treaty of Friendship and Commerce with the British and in 1850, he signed a similar treaty with the United States, which, after a series of events, resulted in the first consul of the US, Charles Lee Moses, burning down his consulate. Over the years, the Sultans of Brunei ceded further stretches of territory to Sarawak; in 1877, stretches to the east of the capital were leased (later ceded) to the British North Borneo Chartered Company (North Borneo). Eventually, due to these seizures of territory, which was accepted by the sultan for annual lease payments, the British occupied the vast majority of the coast of Brunei. The Sultan only stopped handing over territory when Sarawak asked for Limbang, which the Sultan refused. Against the Sultan's wishes, Sarawak obtained control over the territory.
In 1906, the British started a residency in Brunei. This was averted from greater British control from a friendly report by Malcolm Stewart Hannibal McArthur, who prevented the nation from being colonized completely, in the Report on Brunei in 1904. This residency, with the Sultan having control over internal policies, continued until 1984. During this residency, oil was discovered, in 1928, by Shell. This is what has changed the country from its former impoverished state to a much wealthier one today. 
Prior to Independence.
The Sultan of Brunei participated in efforts to form a federation of Malaysia with the Federation of Malaya, Crown Colony of Sarawak, Crown Colony of North Borneo and the Colony of Singapore, but decided not to in the end due to the issue of oil profits and massive popular opinion against the move. This wish by the sultan resulted in a coup by the most populous party in the nation, comprising a vast majority of the population, by the Brunei People's Party (PRB). This failed due to poor organisation and their leader, A.M. Azahari, not even being in the country during the coup. Another option considered was a federation between North Borneo, Sarawak, and Brunei, but this was rejected due to oil revenues and the possible limitation of the Sultan's power. 
Independence.
On 14 November 1971, Sultan Hassanal Bolkiah left for London to discuss matters regarding the amendments to the 1959 constitution. A new agreement was signed on 23 November 1971 with the British representative being Anthony Royle.
Under this agreement, the following terms were agreed upon:
This agreement also caused Gurkha units to be deployed in Brunei, where they remain up to this day.
On 7 January 1979, another treaty was signed between Brunei and the UK. It was signed with Lord Goronwy-Roberts being the representative of the UK. This agreement granted Brunei to take over international responsibilities as an independent nation. Britain agreed to assist Brunei in diplomatic matters. In May 1983, it was announced by the UK that the date of independence of Brunei would be 1 January 1984.
On 31 December 1983, a mass gathering was held on main mosques on all four of the districts of the country and at midnight, on 1 January 1984, the Proclamation of Independence was read by Sultan Hassanal Bolkiah. The sultan subsequently assumed the title "His Majesty", rather than the previous "His Royal Highness". Brunei was admitted to the United Nations on 22 September 1984, becoming the organisation's 159th member.
After Independence.
Brunei gained its independence from the United Kingdom on 1 January 1984, joining ASEAN on the same year. Economic growth from its extensive petroleum and natural gas fields during the 1990s and 2000s, with the GDP increasing 56% from 1999 to 2008, transformed Brunei into an industrialised country. Brunei has the second-highest Human Development Index among the Southeast Asian nations, after Singapore, and is classified as a "developed country". In 2014, the Sultan instituted an Islamic Sharia penal code