William was a delicate, posthumous child, whose father had died a few days before his birth, but he grew up determined to defend his country against the threat from France on his southern border. He led his army in person, and carefully built up the Grand Alliance against the French.
He was on good terms with his uncles, Charles II and James, visiting them and corresponding regularly with them, but he became increasingly concerned about James VII's Catholicism and so he was prepared to accept the British invitation to displace his father-in-law in 1688.
Having deposed James on 4 April 1689, the Scottish Convention of Estates voted to offer the crown to William and Mary. They were proclaimed on 11 April and accepted the crown on 11 May.
Preoccupied as he was with continental politics, William never did visit Scotland. As a Calvinist he was at first popular with the Scots, although James VII and II's supporters, the Jacobites, rose against him in 1689.
They won a victory at Killiecrankie in Perthshire, but their leader Viscount Dundee was killed and they were crushed at Dunkeld, some miles further south.
Even so, armed resistance continued in the Highlands until 1692, and the Bass Rock held out for James until April 1694.
William's severe measures against the Jacobites made him unpopular in Scotland, as did his part in approving the 1692 Massacre of Glencoe, when the elderly chief of the MacDonalds of Glencoe failed through a misunderstanding to take the oath of allegiance to William by the appointed date and was murdered with a number of his clansmen on government orders.
William's apparently callous disregard for the interests of those Scots who tried to set up a Scottish trading colony at Darien, on the Isthmus of Panama, also led to widespread anger against him.
William and Mary had no children. She died of smallpox in 1694, he in 1702, after a fall from his horse.