Spain managed to hold on to most of the scattered Habsburg empire, and help the imperial forces of the Holy Roman Empire reverse a large part of the advances made by Protestant forces, but it was finally forced to recognise the separation of Portugal (with whom it had been united in a personal union of the crowns from 1580 to 1640) and the Netherlands, and eventually suffered some serious military reverses to France in the latter stages of the immensely destructive, Europe-wide Thirty Years' War.