With the signing of the Heligoland-Zanzibar Treaty between the United Kingdom and the German Empire in 1890, Zanzibar itself became a British protectorate. In August 1896, following the death of Sultan Hamad bin Thuwaini, Britain and Zanzibar fought a 38-minute war, the shortest in recorded history. A struggle for succession took place as the Sultan's cousin Khalid bin Barghash seized power. The British instead wanted Hamoud bin Mohammed to become Sultan, believing that he would be much easier to work with. The British gave Khalid an hour to vacate the Sultan's palace in Stone Town. Khalid failed to do so, and instead assembled an army of 2,800 men to fight the British. The British launched an attack on the palace and other locations around the city after which Khalid retreated and later went into exile. Hamoud was then peacefully installed as Sultan.