The Treaty of Ryswick chastened the ageing monarch, who interpreted the disappointment and suffering that the Nine Years War had inflicted on him, his state, and his people as an act of divine will, as caution or even condemnation. In addition, Louis was no longer a young man driven by the need to establish his glory through warfare, and could be more confident in his frontiers, having buttressed them through numerous annexations. Thus, he now worked to find a peaceful way to distribute the lands of Carlos II, as that Spanish king came to the end of his life. However, fate overcame the best efforts of princes and diplomats when Carlos II died leaving all this domain to Philippe of Anjou, the grandson of the Sun King. Unfortunately, and perhaps unavoidably, war overcame Europe again over this matter of the Spanish succession. Already weakened by the huge costs of the Nine Years War, France could ill afford another great war so soon after the conclusion of the last. French arms, virtually invincible for so long, were anything but in the new conflict, and the duke of Marlborough and prince Eugene of Savoy gained years of victories over Louis's less talented commanders. Still, France did not collapse, any more than had its foes in the Nine Years War, when Louis's armies had seemed so dominant. Instead, France suffered and survived until Marshal Villars led French armies to victory during the last years of the war. It would be foolish to call the War of the Spanish Succession a triumph for Louis, but neither did it end in defeat, for he finally won the Spanish throne for his grandson, retained the territorial gains he had gained in earlier wars, and reasserted French military prowess.