Edinburgh Castle became one of the most significant royal centres in Scotland. Malcolm's son King Edgar died here in 1107. Malcolm's youngest son, King David I (r.1124–1153), developed Edinburgh as a seat of royal power principally through his administrative reforms (termed by some modern scholars the Davidian Revolution). Between 1139 and 1150, David held an assembly of nobles and churchmen, a precursor to the parliament of Scotland, at the castle. Any buildings or defences would probably have been of timber, although two stone buildings are documented as having existed in the 12th century. Of these, St. Margaret's Chapel remains at the summit of the rock. The second was a church, dedicated to St. Mary, which stood on the site of the Scottish National War Memorial. Given that the southern part of the Upper Ward (where Crown Square is now sited) was not suited to be built upon until the construction of the vaults in the 15th century, it seems probable that any earlier buildings would have been located towards the northern part of the rock; that is around the area where St. Margaret's Chapel stands. This has led to a suggestion that the chapel is the last remnant of a square, stone keep, which would have formed the bulk of the 12th-century fortification. The structure may have been similar to the keep of Carlisle Castle, which David I began after 1135. David's successor King Malcolm IV (r.1153–1165) reportedly stayed at Edinburgh more than at any other location. But in 1174, King William "the Lion" (r.1165–1214) was captured by the English at the Battle of Alnwick. He was forced to sign the Treaty of Falaise to secure his release, in return for surrendering Edinburgh Castle, along with the castles of Berwick, Roxburgh and Stirling, to the English King, Henry II. The castle was occupied by the English for twelve years, until 1186, when it was returned to William as the dowry of his English bride, Ermengarde de Beaumont, who had been chosen for him by King Henry. By the end of the 12th century, Edinburgh Castle was established as the main repository of Scotland's official state papers. Wars of Scottish Independence A century later, in 1286, on the death of King Alexander III, the throne of Scotland became vacant. Edward I of England was appointed to adjudicate the competing claims for the Scottish crown, but used the opportunity to attempt to