Hamerton was a friend of Said bin Sultan, the last ruler of the Omani Empire, with the sultan giving Hamerton a building abutting the sea in the town centre as a residence, waiving the rent.[2] The British were keen to exploit this friendship to end the slave trade in Zanzibar, which was flourishing at the time. The Moresby Treaty of 1822 had restricted the Zanzibar slave trade, but not banned it.
Hamilton was therefore told when on leave in Bombay in 1843 that the Company wanted him to intervene with Said. This was more easily said than done, as Said responded to the promptings of Hamerton by reminding him that slavery was condoned by Islam: "The Koran, the word of God . . . sanctioned it, and the Arabs, of all Mahomedans, the people considered by the Almight as most deserving of favour, had a right to enslave infidels."[3]
But Hamerton was a persuasive negotiator and the fruit of his work was a treaty signed by Said in 1845, known as the "Hamerton Treaty" – despite most of the work having been done by Lord Aberdeen and the Foreign Office[2] – which outlawed the export of slaves from Zanzibar to the Persian Gulf area.
It soon became apparent, however, that this was mere posturing by the sultan and the Company, the latter doing nothing to enforce the terms of the treaty, and Britain having few warships in the area.[2] So the slave trade continued as before, with Hamerton reckoning that three-quarters of Zanzibar's population were slaves.[3]
It was followed by the Frere Treaty in 1873.