During the 19th century, the Bruneian Empire began to decline. The Sultanate ceded Sarawak (Kuching) to James Brooke and installed him as the White Rajah, and it ceded Sabah to the British North Borneo Chartered Company. In 1888, Brunei became a British protectorate and was assigned a British resident as colonial manager in 1906. After the Japanese occupation during World War II, in 1959 a new constitution was written. In 1962, a small armed rebellion against the monarchy was ended with the help of the British.