In the late 1800s, the British North Borneo Company (BNBC) began to establish colonies throughout North Borneo (now Sabah). In 1882, the Company founded a small settlement on Gaya Island (Pulau Gaya), which was already inhabited by the Bajau people. In 1897, this first settlement was burned and destroyed by Bajau rebels led by Mat Salleh.
After the rebellion, the Company decided to relocate the settlement to the more easily defended mainland opposite Pulau Gaya. A nearby fishing village named Api-Api (see Original namesNorth Borneo Railway. It was expanded and renamed Jesselton, named after Sir Charles Jessel, the then Vice Chairman of the Company. below), was the next settlement of the Company. This new location was then designated as the main harbour and port, as well as the terminus for the
Eventually, Jesselton became a major trading post of North Borneo, dealing in rubber, rattan, honey, and wax. The new railway was used to transport goods to Jesselton harbour. Bajau uprisings during these times were not uncommon, and the Company worked to quell the long-standing threat of piracy in the region.
Jesselton was razed by the retreating British early in World War II to prevent it from falling into the hands of the Japanese. After the Japanese takeover of Borneo, it was again renamed Api. Rebellions against the Japanese military administration have taken place in Api. One major rebellion occurred in 1943 by the group called Kinabalu Guerrillas, consisting of local inhabitants. The rebellion was however quelled by the Japanese forces, after their leader, Albert Kwok, was arrested and executed in 1944. At the later stages of the war, what remained of the town was destroyed again by Allied bombings as part of the Borneo Campaign in 1945, leaving only three buildings standing. The war in North Borneo ended with the official surrender of the Japanese 37th Army by Lieutenant General Baba Masao in Labuan on September 10, 1945.
After the war, the British North Borneo Company returned to administer Jesselton but was unable to finance the huge costs of reconstruction. They gave control of North Borneo to the British Crown in 1946. The new colonial government elected to rebuild Jesselton as the capital of North Borneo instead of Sandakan, which had also been destroyed by the war.
When North Borneo together with Sarawak, Singapore & Federation of Malaya formed the Federation of Malaysia in 1963, the state became known as Sabah and Jesselton remained its capital. Jesselton was renamed Kota Kinabalu on September 30, 1968 and received official city status from the Malaysian government on February 2, 2000.