As tin mining developed further, the Palembang Sultanate sent for experts in Malay Peninsula and China. The Dutch East India Company managed to secure a monopolistic tin purchase agreement in 1722, but hostilities began to develop between the Sultan and the Dutch. During the British invasion of Java in 1811, then-Sultan Mahmud Badaruddin attacked and massacred the staff of the Dutch post on the island. He was later deposed and executed by the British. His successor ceded Bangka to Britain in 1812, but in 1814 Britain exchanged it with the Dutch for Cochin in India following the Anglo-Dutch Treaty of 1814.