William Stanley (1655-1702) succeeded his father as ninth earl of Derby in 1672 and as lord lieutenant for Lancashire and Cheshire in 1676. Throughout his political career, during which he and his right-hand man Richard Kenyon managed the Tory interest in Lancashire, he attempted to hedge his bets when factions came into conflict, a course that was to prove personally disastrous after William of Orange’s invasion.
In the weeks leading up to the invasion he was swearing loyalty to James II while at the same time putting out feelers to the English supporters of William of Orange, one of whom was his Whig rival Lord Delamere, who Derby had arrested for treason after the Monmouth Rebellion. His support for James briefly regained him the lieutenancies of Lancashire and Cheshire which he had lost when James attempted to assert control in the North-West by putting his own people in positions of authority.
Derby’s alliance with Delamere did not long survive the revolution. He was lukewarm in his support for William in the weeks after the invasion, whereas Delamere was at the forefront of the forces heading south to join William. Soon Delamere was denouncing his long-time rival to William. Derby was replaced by Delamere as lord lieutenant of Cheshire, and in disgust refused the lieutenancy of Lancashire. He was reappointed to both offices shortly before his death in 1702. His brother James Stanley succeeded him as earl. 
A fuller account of Derby’s role in Lancashire politics is provided by Barry Coward.