Subsequently, Philip II of Spain claimed the throne and was accepted as Philip I of Portugal. Portugal did not lose its formal independence, briefly forming a union of kingdoms. At this time Spain was a geographic territory. The joining of the two crowns deprived Portugal of an independent foreign policy and led to its involvement in the Eighty Years' War between Spain and the Netherlands.