The history of Sabah can be traced back to about 23–30,000 years ago when evidence suggests the earliest human settlement in the region existed. The history is interwoven with the history of Brunei and the history of Malaysia, which Sabah was previously part of and is currently part of respectively. The earliest recorded history of Sabah being part of any organised civilisation began in the early 15th century during the thriving era of the Sultanate of Brunei. Prior to this, early inhabitants of the land lived in predominantly tribal societies, although such tribal societies had continued to exist until the 1900s. The eastern part of Sabah was ceded to the Sultan of Sulu by the Sultan of Brunei in 1704 for assisting Brunei in suppressing a revolt, but many sources stated it had not been ceded at all. By the late 19th century, both territories previously owned by Sultan of Brunei and Sultan of Sulu was granted to British syndicate and later emerged as British North Borneo under the management of the North Borneo Chartered Company. Sabah became a protectorate of the United Kingdom in 1888 and subsequently became a Crown colony from 1946 until 1963, during which time it was known as Crown Colony of North Borneo. On 16 September 1963, Sabah merged with Malaya, Sarawak and Singapore (left in 1965) to form Malaysia.
Prehistoric Sabah
During the Last Glacial Maximum about 20,000 years ago, Sabah and the rest of Borneo island was connected to mainland Asia in a landmass known as the Sundaland. Subsequent deglaciation, which caused global sea level to rise, resulted in the Sundaland being submerged, separating Borneo from the rest of Asia. Earliest human settlement in the region is believed to have dated back about 20,000–30,000 years ago. These early humans are believed to be Australoid or Negrito people, but the reason for their sudden disappearance is unknown. Stone tools and artefacts have been found in Madai and Baturong caves and in the archaeological site in Lake Tingkayu near the district of Kunak which were estimated to date back from 28,000 to 17,000 years ago. The tools found there were considered advanced for its period. There was evidence of human cave-dwellings around 15,000–6,000 years ago. An ongoing 2012 study by Universiti Sains Malaysia and Sabah State Museum revealed the discovery of stone tools in Mansuli Valley near Lahad Datu believed to be 235,000 years old, and in another site in Lipasu Village, Bingkor believed to be at least 200,000 years old. These recent findings suggests that human settlement in Sabah and Malaysia have existed much earlier than previously thought, which is about 40,000 years ago in Niah Caves, Sarawak.
The earliest ascertained wave of human migration, believed to be Austronesian, occurred around 5,000 years ago. This wave of migration is believed to represent the time when the indigenous hill people of present-day Sabah had first arrived, namely the Murut, Lundayeh, Kadazan-Dusun and Orang Sungai, while Brunei Malays settlement appeared somewhat later. It is believed that some Australoid or Negrito people have interbred with later Austronesian migrants and remained in Borneo, while others have migrated to other places such as Melanesia, the Lesser Sunda Islands and Australia continent. Some anthropologists such as S.G. Tan and Thomas R. Williams believe that the Austronesian are more closely related to a number of indigenous groups in the Philippines and Formosa (Taiwan) than to the indigenous peoples of neighbouring Sarawak and Kalimantan, These claims were also supported by the findings of Charles Hose and William McDougall in their account of the "Pagan Tribes of Borneo".
Pre-15th century
During the 7th century, a settled community known as Vijayapura, a tributary to the Srivijaya empire, was thought to have been the earliest beneficiary to the Bruneian Empire existing around the northeast coast of Borneo, founded by the Funan Prince among the early coastal Dusun people. Another kingdom which was suspected to have existed according to Chinese records beginning the 9th century was P'o-ni, also founded by the ancient Dusun people. It was believed that Po-ni existed at the mouth of Brunei River and was the predecessor to the Sultanate of Brunei.
Around 1322, the first Christian mission to arrive in northern Borneo was by the Italian Odoric of Pordenone (also mentioned variously as Odorio, Odoric or Odorico Mattiussi). Further, in 1567, North Borneo received another two Jesuit missionaries from the Kingdom of Portugal but was interrupted by the Dutch in 1600, and in 1587, another two Franciscan missionaries from the Spanish East Indies. In 1687, a Theatine missionary named was commissioned by Pope Innocent XI to preach Christianity in Borneo, he further lived on the eastern coast of northern Borneo for five years, marking the further chapter of Christian missions within northern Borneo despite earlier struggles to reach the local indigenous natives.
The Brunei Annals in 1410 mentioned about a Chinese settlement or province centring in the Kinabatangan Valley in the east coast surrounding Kinabatangan River founded by a man known as Ong Sum Ping. This is consistent with the recent discovery of timber coffins in the Agop Batu Tulug cave in the Kinabatangan Valley, belong to the Dusun Sukang tribe. The coffins, adorned with carvings believed to resemble similar cultural practices in China and Vietnam, are believed to date back from around 700 to 1,000 years ago (11th to 14th century). From the 14th century, the Majapahit empire expanded its influence towards Brunei and most of the coastal region of Borneo.
Bruneian Empire and the Sulu Sultanate
The Sultanate of Brunei began after the ruler of Brunei embraced Islam, and was established by the Bruneian Murut or Lun Bawang; some also suggested the Bisaya (Dusunic speaker) who established the early stage of Bruneian Empire. Some sources indicate that this had occurred around 1365 after the ruler, Awang Alak Betatar, converted into Islam and became known as Muhammad Shah. Other sources suggests that the conversion occurred much later around 1514 to 1521, albeit, under the same person. During the same period, trade relations flourished, and intermarriages among the native peoples of Borneo with Chinese and Arab traders became common. The intermixing of blood resulted in a distinct breed both in physical stature and features. Prior to the expansion of the Sultanate of Brunei, most of the coastal region of Borneo then came under the rule of the Bruneian Empire during the reign of the fifth sultan known as Bolkiah between 1485 and 1524, with the Sultanate's thalassocracy extended over Sabah, Sulu Archipelago and Manila in the north, and Sarawak until Banjarmasin in the south. This was during the period when the Sultanate was in its 'golden era'.
In 1704, the Sultan of Brunei ceded the northern and eastern portion of Borneo to the Sultanate of Sulu in compensation for the latter's help in settling the Brunei Civil War in the Brunei Sultanate. The Sultan of Brunei continued to loosely govern the west coast of Sabah. Many Brunei Malays migrated to this region during this period, although the migration has begun as early as the 15th century after the Brunei conquest of the territory. While the thalassocratic Brunei and Sulu sultanates controlled the western and eastern coasts of Sabah respectively, the interior region remained largely independent from either kingdoms. Since the late 18th century, the seafaring Bajau-Suluk people also arrived from the Sulu Archipelago and started to settling in the coasts of north and eastern Borneo. It is believed that they were fleeing from the oppression of the Spanish colonies in their region.
British North Borneo
In 1761, Alexander Dalrymple, an officer of the British East India Company, concluded an agreement with the Sultan of Sulu to allow him to set up a trading post in the region. This plan, together with other attempts to build a settlement and a military station centring on Balambangan Island, proved to be a failure. A map by Dalrymple of North Borneo is exhibited in the National Museum of Scotland. There was minimal foreign interest in this region afterward and control over most parts of north Borneo seems to have remained loosely under the Sultanate of Brunei. In 1846, the island of Labuan on the west coast of Sabah was ceded to Britain by the Sultan of Brunei and in 1848 it became a British Crown Colony. Labuan became a base for British operations against piracy in the region. The first recorded ascent of Mount Kinabalu, the highest mountain in Borneo, was made in 1851 by British Malaya colonial administrator and naturalist Hugh Low. The highest peak and the deep gully of the mountain was later named after him.
In 1865, the American Consul General of Brunei, Charles Lee Moses, obtained a 10-year lease over North Borneo from the Sultan of Brunei Abdul Momin. Ownership was then passed to an American Trading Company of Borneo owned by Joseph William Torrey, Thomas Bradley Harris and some Chinese merchants. They set up a base and settlement in Kimanis and the Sultan of Brunei appointed Torrey as "The Rajah of Ambong and Marudu". His fortress "Ellena" was located in Kimanis with hundreds of Iban trackers led by Lingkanad. Torrey returned to America in 1877 and died near Boston, Massachusetts, in March 1884. The rights of the trading company were then sold to Gustav Baron Von Overbeck, the Austro-Hungarian Consul in Hong Kong (though he was actually a German national), and he later obtained another 10-year renewal of the lease. The lease was subsequently converted into a cession via a treaty which was signed by the Sultan of Brunei Abdul Momin. In the treaty, the Sultan appointed Overbeck as "Maharajah of Sabah and Rajah of Gaya and Sandakan." The treaty granted Overbeck the right over the whole region of Sabah, including the parts purporting to be the dominion of the Sulu Sultanate, as well as Sandakan and Tawau. The treaty was signed on 29 December 1877 at the Brunei Palace. In 1880, Overbeck offered to trade the territory as a penal colony to the Kingdom of Italy, but with pressure from the British, the Italian government refused to the proposal and Britain acquired the region soon after. Similar offer were also made to Austria-Hungary and the German Empire.
On the east coast of North Borneo near Sandakan, William Cowie, on behalf of Dent's company, negotiated and obtained a concession in perpetuity from the Sultan of Sulu over its holdings in this region in 1878. This concession was signed on 22 January 1878 in the palace of the Sultan of Sulu. The concession later became the subject of dispute by the modern republic of the Philippines regarding the historical connection with the eastern part of Sabah. The rights were subsequently transferred to Alfred Dent, who on 26 August 1881 formed the British North Borneo Provisional Association Ltd. On 1 November 1881, the British government granted a royal charter and the British North Borneo Chartered Company was subsequently formed. William Hood Treacher was appointed as the first British Governor of North Borneo, with Kudat became the first capital.
As the population was too small to fully economically exploit the region, the company brought in Chinese people mainly Hakkas from Guangdong province to work as labourers in plantation farms. Most of the migrants settled in Kudat and Jesselton (now Kota Kinabalu). The capital was moved to Sandakan in 1884 to capitalise on its potential of vast timber resources. In 1885, United Kingdom, Spain and Germany signed the Madrid Protocol of 1885. The purpose of the protocol was to recognise the sovereignty of Spain in the Sulu Archipelago and also for Spain to relinquish all claims it might have had over North Borneo.