An able and popular king, he was successful in restoring order to Scotland, quelling an uprising of discontented nobles, and improving the prosperity of the kingdom. He made peace with England by the Treaty of Ayton (1497–98), and married Henry VII’s daughter Margaret Tudor, which brought the Stuart line to the English throne in 1603. He led his country into a disastrous war with Henry VIII of England and was himself killed at Flodden Field.