After the Scots agreed an alliance with France, King Edward I of England invaded Scotland with a large army intending to take full control. Edward's forces easily defeated the Scots at the 1296 Battle of Dunbar. Edward deposed King John Balliol, had him imprisoned, and took steps to ensure Scotland could not oppose English rule going forward, such as demanding nobles swear loyalty and appointing English officials. His actions deeply angered the Scottish people and laid the groundwork for the Wars of Scottish Independence.