The castle was built by order of Queen Elizabeth 1 to protect Royal Navy dockyards at Chatham which were used to build and repair warships. The location of the dockyards was ideal being in a sheltered position close to London, and ships were often moored in the ordinary, which meant with their sails removed.
Despite placing a chain across the river to stop enemy ships from sailing past, in 1667 the Dutch Republic navy commanded by Admiral de Ruyter was able to get ships past Upnor Castle and attack the dockyards. It's thought there was limited resistance from workers at the Chatham dockyards as they had not been paid for two years.
Upnore Castle was not significantly damaged during the Dutch incursion, but neither was it particularly successful at preventing it, most likely due to a lack of munitions. When the Dutch fleet left two days later, many ships at the dockyards had either been destroyed or captured.