The pre-Islamic history of Brunei is unclear, but archaeological evidence shows the country to have been trading with the Asian mainland as early as CE 518. Islam became predominant during the 14th century and the Brunei Sultanate rose to prominence in the 15th and 16th centuries, when it controlled coastal areas of North-West Borneo, parts of Kalimantan and the Philippines. The Dutch, Portuguese and Spanish began arriving after the 16th century. Brunei lost outlying possessions to the Spanish and the Dutch and its power gradually declined as the British and Dutch colonial empires expanded.
In the 19th century the Sultan of Brunei sought British support in defending the coast against Dayak pirates, and ennobled James Brooke, a British adventurer, as Rajah of Sarawak in 1839. The British proceeded to annex the island of Labuan in 1846. North Borneo became a British protected state in 1888 and Brunei voluntarily accepted the status of a British protected state under the Sultan, with Britain having charge of its foreign relations. The loss of Limbang district to Sarawak in 1890 split Brunei into two and remains an obstacle to good relations with Malaysia to this day.
In 1906 a treaty was signed between Britain and Brunei making Brunei a full protectorate. The treaty assured the succession of the ruling dynasty, with the arrangement that a British resident would advise the Sultan on all matters except those concerning local customs and religion.
In 1929 large resources of oil were discovered in Seria; these and subsequent discoveries made Brunei a wealthy country. In 1959 a written constitution was introduced, giving Brunei internal self- rule and allowing for a legislative council. The residency agreement of 1906 was revoked, transferring the resident’s power to the Sultan and appointed officials below him.
During 1962 there were sporadic and unsuccessful attempts at rebellion, instigated by the North Borneo Liberation Army. These were put down with the help of British Gurkha units flown in from Singapore and the Sultan declared a state of emergency. This has been renewed every two years since.
In the 1960s, Brunei considered merging with the Federation of Malaysia, which at the time included the provinces of the Malaysian peninsula, Sabah, Sarawak and Singapore. The idea was opposed by the Brunei People’s Party, which at that time held 16 seats in the 33-member legislative council, and which proposed instead the creation of a state comprising Northern Borneo, Sarawak and Sabah. The Sultan finally decided against joining the Federation.
In 1971, under an agreement with the UK, Brunei ceased to be a British protected state. The constitution was amended to give the Sultan full control over all internal matters, the UK retaining responsibility for defence and foreign affairs. Brunei became a fully independent sovereign state on 1 January 1984.