In 1511, Malacca was conquered by Portugal, after which it was taken by the Dutch in 1641. In 1786, the British Empire established a presence in Malaya, when the Sultan of Kedah leased Penang Island to the British East India Company. The British obtained the town of Singapore in 1819, and in 1824 took control of Malacca following the Anglo-Dutch Treaty. By 1826, the British directly controlled Penang, Malacca, Singapore, and the island of Labuan, which they established as the crown colony of the Straits Settlements. By the 20th century, the states of Pahang, Selangor, Perak, and Negeri Sembilan, known together as the Federated Malay States, had British residents appointed to advise the Malay rulers, to whom the rulers were bound to defer by treaty. The remaining five states in the peninsula, known as the Unfederated Malay States, while not directly under British rule, also accepted British advisers around the turn of the 20th century. Development on the peninsula and Borneo were generally separate until the 19th century. Under British rule the immigration of Chinese and Indians to serve as labourers was encouraged. The area that is now Sabah came under British control as North Borneo when both the Sultan of Brunei and the Sultan of Sulu transferred their respective territorial rights of ownership, between 1877 and 1878. In 1842, Sarawak was ceded by the Sultan of Brunei to James Brooke, whose successors ruled as the White Rajahs over an independent kingdom until 1946, when it became a crown colony.