The Earldom of Orkney was held for the Norwegian (and later Danish) Crown until 1468, at which time the impoverished Christian I, King of Denmark, Norway and Sweden, gave Orkney to the Scottish Crown as part of a marriage agreement with King James III.
The Scottish king was to marry Christian's daughter, Margaret, and by this agreement Orkney was held as a pledge, redeemable by the payment of 50,000 Rhenish Florins.
At the end of the first year the payment had not been forthcoming so Shetland was pledged for a further 8,000 Florins.
Two years later, Christian had still not made the payment so the Earldom of Orkney and Lordship of Shetland were annexed to the Scottish Crown.
http://www.orkneyjar.com/history/history6.htm