The Sultanate of Sulu was granted the north-eastern part of the territory as a prize for helping the Sultan of Brunei against his enemies in 1658. However, on 22 July 1878, the Sultanate of Sulu relinquished the sovereign rights over all his possessions in favour of Spain, based on the "Bases of Peace and Capitulation" signed by the Sultan of Sulu and Spain in Jolo. The Spanish then claimed the area in northern Borneo but ending its claim soon under the Madrid Protocol of 1885 after the United Kingdom and Germany recognised its presence in the Philippine archipelago in return for the Spanish to stop interfering the British affairs in northern Borneo. Once the protocol had been ratified, the British North Borneo Chartered company proceeded with the administration of North Borneo, and in 1888, North Borneo became a British protectorate.