James Brooke, the first "White Rajah"
Kuching was supposedly founded by a representative of the Sultan of Brunei in 1827, although there was almost certainly a trading village on the site long before that. At the time, all of Sarawak was under the rule of the Sultan, although there was a lot of unrest among some of the tribes. It was during one of these uprisings that the Sultan turned to James Brooke for assistance.
Brooke was born in 1803 in India of British parents. He was sent to England at the age of 12 to continue his education, and returned to India in 1819 to serve i the Bengal Army. He was seriously wounded in action in 1825 and returned to England to recover. He returned to Madras in southeastern India in 1830, but was too late to rejoin his unit. He resigned from the army and returned to England.
In 1833, Brooke received an inheritance, which he used to purchase a schooner, The Royalist. Setting sail for Southeast Asia, Brooke first arrived in Kuching in 1838, where as the saying goes, "the natives were restless". Accounts differ on whether the Sultan of Brunei sought Brooke's help or he offered it, but in any case the Englishman successfully quelled the uprising. In return for his help - and according to some not without threats - the Sultan ceded Sarawak to Brooke.
The White Rajahs of Sarawak
Brooke took, or was given, the title of Rajah and began to cement his rule over Sarawak. Although Brooke was knighted and appointed governor of Labuan, it's useful to note that Sarawak was not a crown colony and remained under the direct rule of the Brookes until after World War II.
Brooke had no legitimate children. It seems he preferred the company of men, although he acknowledged at least one illegitimate child. He appointed his nephew, Charles Anthony Johnson Brooke, to succeed him as Rajah. James Brooke died in 1868.
Charles Anthony Johnson Brooke built most of the structures that survive to this day, such as Fort Margherita, the courthouse complex and the Sarawak Museum. Charles Anthony Johnson Brooke died in 1917 and was succeeded by his son, Charles Vyner Brooke.
Charles Vyner Brooke was much more "hands-off" in the administration of Sarawak than his father and James Brooke had been. In 1941, just before the Japanese invaded, he even granted the territory a new constitution that limited his own powers as Rajah. Brooke was in Sydney, Australia when the Japanese took control of Sarawak, and remained there for the duration of the war.
Brooke returned to Sarawak after World War II in 1946, but within a few months he ceded Sarawak to the English government as a crown colony, thus ending the line of White Rajahs. Charles Vyner Brooke died, of apparent suicide, in London in 1963 just a few months before Malaysian independence.
With the end of the White Rajahs, Sarawak became one of four Malaysian states that do not have hereditary native rulers. Instead, the state has a governor appointed by the elected King of Malaysia. The official residence for the governor of Sarawak is still the Astana, the palace built by White Rajah Charles Vyner Brooke.