and the New World. Charles II of Spain was an invalid with no prospect of having children; some of his closest relatives included Louis XIV and Leopold I, Holy Roman Emperor. William sought to prevent the Spanish inheritance from going to either monarch, for he feared that such a calamity would upset the balance of power. William and Louis XIV agreed to the First Partition Treaty (1698), which provided for the division of the Spanish Empire: Joseph Ferdinand, Electoral Prince of Bavaria, would obtain Spain, while France and the Holy Roman Emperor would divide the remaining territories between them. Charles II accepted the nomination of Joseph Ferdinand as his heir, and war appeared to be averted. When, however, Joseph Ferdinand died of smallpox in February 1699, the issue re-opened. In 1700 William and Louis XIV agreed to the Second Partition Treaty (also called the Treaty of London), under which the territories in Italy would pass to a son of the King of France, and the other Spanish territories would be inherited by a son of the Holy Roman Emperor. This arrangement infuriated both the Spanish, who still sought to prevent the dissolution of their empire, and the Holy Roman Emperor, who regarded the Italian territories as much more useful than the other lands. Unexpectedly, Charles II of Spain interfered as he lay dying in late 1700. Unilaterally, he willed all Spanish territories to Philip, the Duke of Anjou, a grandson of Louis XIV. The French conveniently ignored the Second Partition Treaty and claimed the entire Spanish inheritance. Furthermore, Louis XIV alienated William III by recognising James Francis Edward Stuart, the son of the former King James II (who died in September 1701), as de jure King of England. The subsequent conflict, known as the War of the Spanish Succession, broke out in July 1701 and continued until 1713/1714. English royal succession Another royal inheritance, apart from that of Spain, also concerned William. His marriage with Mary had not produced any children, and he did not seem likely to remarry. Mary's sister, Anne, had borne numerous children, all of whom died during childhood. The death of her last surviving child (Prince William, Duke of Gloucester) in 1700 left her as the only individual in the line of succession established by the Bill of Rights. As the complete exhaustion of the defined line of succession would have encouraged a restoration of James