The First War of Scottish Independence lasted from the outbreak of the war in 1296 until the 1328.
The Scots were defeated at Dunbar on 27 April 1296. John Balliol abdicated in Montrose castle on 10 July 1296. John was imprisoned in the Tower of London at first, but then released into the custody of Pope Boniface VIII on condition that he remain in a papal residence. He was later released around the summer of 1301 and lived the rest of his life on his family's estates in Picardy.
But his supporters argued that he was still the rightful King of Scotland. Therefore, the Scots rose in rebellion in 1297 under William Wallace and Andrew de Moray and said they were acting on behalf of King John. But in fact Scotland had no monarch until the accession of Robert the Bruce in 1306.