When Alexander III of Scotland died in 1286 by falling off a cliff (which is another whole story–what king dies falling off a cliff when riding from one castle to another alone in the fog? Whatever.), he left Scotland without a king. He had one living grandchild, Margaret, otherwise known as the ‘Maid of Norway’. She was the child of Alexander’s daughter, who’d died at her birth, and Erik, the King of Norway.
The succession was already in trouble after King Alexander’s only son died, two years earlier: “When Prince Alexander died on 28 January 1284, leaving only the king’s granddaughter Margaret living out of his descendants, Alexander III summoned all thirteen Earls of Scotland, twenty-four barons and the heads of the three main Gaelic kindreds of the West, Alexander of Argyll, Aonghas Mór of Islay and Alan MacRuari of Garmoran. At Scone on 5 February 1284, the signatories agreed to recognise Margaret as “domina and right heir” if neither Alexander had left a posthumous child and the king had left no children at the time of his death. However, it is unlikely that this was intended to allow Margaret to rule alone as queen regnant, but rather jointly with her future spouse, whoever he might be. While unexceptional in the circumstances, this would appear to show that Alexander III had decided on remarriage. He did remarry, to Yolande de Dreux, but died on 19 March 1286.” http://en.wikipedia.org/wiki/Margaret,_Maid_of_Norway
Upon his death, Guardians were appointed by Parliament. “After King Alexander III was buried at Dunfermline Abbey on 29 March 1286, the magnates and clerics of the realm assembled at Scone in parliament to select the Guardians of Scotland who would keep the kingdom for the right heir …
This, according to the oaths taken, made Margaret the heir at three years of age, but within weeks John Balliol tried to take the crown with the aid of John Comyn, the Red Comyn. The Bruce family captured strongholds in Galloway, and fighting in the name of the Maid of Norway (Margaret), suppressed the rebellion with many important families like the Stewarts supporting them. In 1289 the Guardians maintained the peace in Scotland between the competing claims of Margaret, Robert Bruce and John Balliol. http://en.wikipedia.org/wiki/Margaret,_Maid_of_Norway
“In Scotland, six Guardians were named to rule the kingdom until an heir could be sorted out. Queen Yolande was insisting she was pregnant. The records are uncertain as to what happened to this child. Accounts say she miscarried, had a stillborn child, a false pregnancy and yet another says she was faking her pregnancy. By November of 1286, it was clear King Alexander had no heir. Scotland was on the brink of civil war with Robert the Bruce and John Balliol contending for the throne. By 1289, the Guardians had gained some stability between the three claimants.
In 1289, Margaret’s father King Eric sent ambassadors to King Edward I of England with documents proclaiming Margaret as Queen. From this point on Edward and Eric worked on a settlement and excluded the Scots until there was a meeting with Edward, Robert the Bruce and some of the Guardians at Salisbury in October of 1289. Edward was pressing for a marriage to his own son, the future Edward II. The Treaty of Birgham was signed in July of 1290, agreeing Margaret would be sent to Scotland before November 1, 1290 and she would marry Prince Edward of England. The treaty called for Scotland to be separate from England but had clauses allowing King Edward I to interfere in Scottish affairs if he saw fit.” http://thefreelancehistorywriter.com/2013/01/11/margaret-maid-of-norway/
“Guardians were appointed to govern the Kingdom during the young Margaret’s minority. There were many among the unruly Scots nobility who considered they had plausible claims to the throne themselves, and disquieted at the thought of sending his young daughter to a land rent by dissension, King Eric of Norway solicited the protection of Scotland’s neighbour and his daughter’s great-uncle, the powerful and covetous Edward I of England.” http://www.englishmonarchs.co.uk/dunkeld_12.htm
“The Guardians of Scotland negotiated a marriage between Margaret and Prince Edward of Caernarvon, son of King Edward I of England. The Treaty of Birgham stated that the children of Margaret and Prince Edward would rule both England and Scotland.
Margaret fell ill during the sea voyage from Norway to Scotland. Her ship, bound for Leith, was sent off course by a storm. It landed on Orkney at St Margaret’s Hope on South Ronaldsay.
In September or October 1290, Margaret died in Orkney. Her body was returned to Norway where she was laid to rest beside her mother in Christ’s Kirk, Bergen.
With the death of the Maid of Norway the Scots had lost the rightful heir to the throne. Rivals claimants from Scotland’s noble families came forward to vie for the crown.” http://www.educationscotland.gov.uk/scotlandshistory/warsofindependence/maidofnorway/index.asp