The Anglo-Zanzibar War was fought between the United Kingdom and Zanzibar on 27 August 1896. With a duration of around 40 minutes, it holds the record of being the shortest war in recorded history. The war broke out after Sultan Hamad bin Thuwaini, who had willingly co-operated with the British colonial administration, died on 25 August 1896, and his nephew, Khalid bin Bargash, seized power in what amounted to a coup d'état. The British favoured another candidate, Hamud bin Muhammed, whom they believed would be easier to work with, and delivered an ultimatum ordering Khalid to abdicate. Khalid refused, and instead assembled an army that consisted of about 2,800 men and the former Sultan's armed yacht H.H.S. Glasgow anchored in the harbour. While Khalid's troops set to fortifying the palace, the Royal Navy assembled five warships in the harbour in front of the palace (three modern protected cruisers, the Edgar class HMS St George, the Pearl class HMS Philomel and the Archer class HMS Racoon; plus the two gunboats HMS Thrush and HMS Sparrow). The British also landed parties of Royal Marines to support the "loyalist" regular army of Zanzibar, numbering 900 men in two battalions led by General Lloyd Mathews, formerly a Royal Navy lieutenant. Despite the Sultan's last-minute efforts to negotiate for peace via the U.S. representative on the island, the Royal Navy ships opened fire on the palace at 9 am on 27 August 1896 as soon as the ultimatum ran out. The Glasgow was soon sunk, and, with the palace falling down around him and escalating casualties, Khalid beat a hasty retreat to the German consulate where he was granted asylum. The shelling stopped after 40 minutes. The British demanded that the Germans surrender the erstwhile Sultan to them, but he escaped to sea on 2 October 1896. He lived in exile in Dar es Salaam until captured by the British in 1916. He was later allowed to live in Mombasa where he died in 1927. As a final act, Britain demanded payment from the Zanzibar government to pay for the shells fired on the country.