Walmer Castle is an artillery fort originally constructed by Henry VIII in Walmer, Kent, between 1539 and 1540. It formed part of the King's Device programme to protect against invasion from France and the Holy Roman Empire, and defended the strategically important Downs anchorage off the English coast. Comprising a keep and four circular bastions, the moated stone castle covered and had 39 firing positions on the upper levels for artillery. It cost the Crown a total of £27,092 to build the three castles of Walmer, Sandown, and Deal, which lay adjacent to one another along the coast and were connected by earthwork defences. The original invasion threat passed, but during the Second English Civil War of 1648–49, Walmer was seized by pro-Royalist insurgents and was only retaken by Parliamentary forces after several months' fighting.