With the death of King Alexander III in 1286, the crown of Scotland passed to his only surviving descendant, his three-year-old granddaughter Margaret. In 1290, the Guardians of Scotland, who had been appointed to govern the realm during the young Queen's minority, drew up the Treaty of Birgham, a marriage contract between Margaret and the five-year-old Edward of Caernarvon, heir apparent to the English throne. The treaty, amongst other points, contained the provision that although the issue of this marriage would inherit the crowns of both England and Scotland, the latter kingdom should be "separate, apart and free in itself without subjection to the English Kingdom". The intent, clearly, was to keep Scotland as an independent entity.
Queen Margaret died in early October in Orkney on her way to Scotland, leaving the throne vacant. The Guardians called upon her fiancé's father, Edward I of England, to decide between various competitors for the Scottish throne in a process known as the Great Cause. One of the strongest claimants, John Balliol, Lord of Galloway, forged an alliance with the powerful Antony Bek, Bishop of Durham, the representative of Edward I in Scotland and began styling himself 'heir of Scotland', while another, Robert Bruce, 5th Lord of Annandale, turned up to the site of Queen Margaret's supposed inauguration with a force of soldiers amidst rumours that his friends the Earl of Mar and the Earl of Atholl were also raising their forces. Scotland looked to be headed for civil war.