as one of his brothers successively became king. Eventually, the Crown came to his youngest son, David I. David was succeeded by his grandsons Malcolm IV, and then by William the Lion, the longest-reigning King of Scots before the Union of the Crowns. William participated in a rebellion against King Henry II of England but when the rebellion failed, William was captured by the English. In exchange for his release, William was forced to acknowledge Henry as his feudal overlord. The English King Richard I agreed to terminate the arrangement in 1189, in return for a large sum of money needed for the Crusades. William died in 1214 and was succeeded by his son Alexander II. Alexander II, as well as his successor Alexander III, attempted to take over the Western Isles, which were still under the overlordship of Norway. During the reign of Alexander III, Norway launched an unsuccessful invasion of Scotland; the ensuing Treaty of Perth recognised Scottish control of the Western Isles and other disputed areas. Alexander III's death in a riding accident in 1286 precipitated a major succession crisis. Scottish leaders appealed to King Edward I of England for help in determining who was the rightful heir. Edward chose Alexander's three-year-old Norwegian granddaughter, Margaret. On her way to Scotland in 1290, however, Margaret died at sea, and Edward was again asked to adjudicate between 13 rival claimants to the throne. A court was set up and after two years of deliberation, it pronounced John Balliol to be king. Edward proceeded to treat Balliol as a vassal and tried to exert influence over Scotland. In 1295, when Balliol renounced his allegiance to England, Edward I invaded. During the first ten years of the ensuing Wars of Scottish Independence, Scotland had no monarch, until Robert the Bruce declared himself king in 1306. Robert's efforts to control Scotland culminated in success and Scottish independence was acknowledged in 1328. However, only one year later, Robert died and was succeeded by his five-year-old son, David II. On the pretext of restoring John Balliol's rightful heir, Edward Balliol, the English again invaded in 1332. During the next four years, Balliol was crowned, deposed, restored, deposed, restored, and deposed until he eventually settled in England, and David remained king for the next 35 years. David II died childless in 1371 and was succeeded by his nephew Robert II of the House of Stuart.