In 1573 the city underwent a siege by Spanish forces under the leadership of Don Fadrique, son of the Duke of Alva.
In 1799, during the French revolutionary wars, an Anglo-Russian expeditionary force captured the city but was ultimately defeated in the Battle of Castricum.