In 1677, William married his cousin Mary II, the daughter of James, Duke of York, and second in line to the English throne. Their union was a politically motivated alliance, intended to bolster Protestant ties and counter Catholic influence in Europe.