In 1781, Great Britain's declared war on the Dutch Republic, opening the Fourth Anglo-Dutch War. As part of its offensive strategy, the British organized an expedition against Dutch colonial outposts on the Gold Coast of Africa (present-day Ghana). Captain Thomas Shirley led the expedition, commanding HMS Leander and several transports carrying two small regiments of independently raised troops under the command of Captain Kenneth Mackenzie of the 78th Foot.
The expedition sailed late in 1781, and arrived off the coast of Africa in January 1782. Pursuant to orders, Shirley first stopped at the primary British outpost of Cape Coast Castle on 5 February, where plans were developed to take the principal Dutch castle at Elmina by land while Leander made a diversionary attack on the nearby St. Jago castle. The expedition arrived at Elmina on 15 February, but high surf prevented the 500 troops from landing until 18 February, and contrary winds prevented Leander from coming close enough to shore to bring its guns to bear on the forts until 20 February. On that day, Shirley raised the agreed signal flag indicating the beginning of his attack, and opened fire on St. Jago shortly after noon. The ship and the fort exchanged fire until dark, and resumed again the next morning, when the land attack on the Elmina Castle began. Fire from both Elmina and St. Jago was directed at Mackenzie's attacking force, which Shirley reported to "retreat very fast". After it became clear the attack had failed, Shirley ceased fire around 11:30 am.
Over the next several weeks the expedition seized, with minimal resistance, four small Dutch forts: Moree (Fort Nassau - 20 guns), Kormantin (Courmantyne or Fort Amsterdam - 32 guns), Apam (Fort Lijdzaamheid or Fort Patience - 22 guns), Senya Beraku (Fort Goede Hoop - 18 guns), and Accra (Fort Crêvecoeur - 32 guns).