In 1296, Edward invaded Scotland, deposing King John. The following year William Wallace and Andrew de Moray raised forces to resist the occupation and under their joint leadership an English army was defeated at the Battle of Stirling Bridge. For a short time Wallace ruled Scotland in the name of John Balliol as Guardian of the realm. Edward came north in person and defeated Wallace at the Battle of Falkirk in 1298. Wallace escaped but probably resigned as Guardian of Scotland. In 1305, he fell into the hands of the English, who executed him for treason despite the fact that he owed no allegiance to England.