In 1847, the sultan ended a treaty with Great Britain and in 1888 Brunei Darussalam officially became a British protectorate. In 1906, the Residential System was established in Brunei Darussalam. A British Resident was nominated as a representative of the British government to advise the sultan in all matters except Malay customs, traditions and Islamic religion.