During the 19th century, many European powers were scrambling for control of Africa. The British Empire, the largest and most powerful empire the world had ever seen, ruled large swathes of the continent..
When the pro-British Sultan Hamad bin Thuwaini of Zanzibar died in 1896, his cousin, Sultan Khalid bin Barghash, succeeded him to the throne. This was in violation of a treaty in place with the British authorities that required candidates for the sultanate to receive permission from the British consul.
The purpose of this treaty was so that the British could ensure that their interests in Zanzibar were upheld. The British consul preferred Hamud bin Muhammed, a much more favorable candidate that supported British interests, and so were heavily dissatisfied with Barghash's unwelcome leadership.
Soon afterwards, the British Empire issued an ultimatum for Barghash to stand down his soldiers and leave the palace. After negotiations were fruitless and the ultimatum went ignored, the British Empire declared war on the Zanzibar Sultanate and immediately sent in a contingent of British and pro-British troops and vessels.
The sultan's forces were quickly overpowered and the entire war lasted only 38 minutes. Despite initial reports claiming that Barghash had been captured and exiled to India, it later emerged that he had escaped when fighting broke out.
Barghash's forces suffered heavy casualties, with 500 killed or wounded, HHS Glasgow (the sultan's royal yacht,) and 2 boats sunk. British forces suffered minimal casualties, with no deaths and only 1 sailor reported as wounded.