Henry maintained peace with Scotland during his reign, where he was the feudal lord of Alexander II. Henry assumed that he had the right to interfere in Scottish affairs and brought up the issue of his authority with the Scottish kings at key moments, but he lacked the inclination or the resources to do much more. Alexander had occupied parts of northern England during the First Barons' War but had been excommunicated and forced to retreat. Alexander married Henry's sister Joan in 1221, and after he and Henry signed the Treaty of York in 1237, Henry had a secure northern frontier. Henry knighted Alexander III before the young King married Henry's daughter Margaret in 1251 and, despite Alexander's refusal to give homage to Henry for Scotland, the two enjoyed a good relationship. Henry had Alexander and Margaret rescued from Edinburgh Castle when they were imprisoned there by a rebellious Scottish baron in 1255 and took additional measures to manage Alexander's government during the rest of his minority years.