During the Portuguese War of Restoration, the castle was assaulted by Spanish troops. The same thing happened in 1762, although both times were unsuccessful.