The Catholic Kings Isabel I and Fernando II unified divided Spain and defeated the Muslim Empire in 1492, coinciding with the discovery of America. Juana I ("The Crazy Queen") became queen in 1505 despite an unhappy marriage. In 1604, King Philip III of Spain and King James I of England signed a perpetual peace treaty ending piracy and support for Dutch rebels. The War of Spanish Succession ended in 1701 with the Archduke Charles defeating Felipe V at the Battle of Almansa. The French occupation of Spain led to the Spanish War of Independence and eventual French expulsion after the Battle of Vitoria.