In 1681 in England, Charles II was in advanced years. He had had a number of mistresses and produced a number of illegitimate children. One of these was James Scott, the Duke of Monmouth, who was very popular, both for his personal charisma and his fervor for the Protestant cause. Charles had no legitimate heirs, and his brother, the future James II of England was openly a Roman Catholic. When Charles's health suffered, there was a panic in the House of Commons over the potential for the nation being ruled by a Roman Catholic king. The Earl of Shaftesbury had sponsored and advocated the Exclusion Bill, which would prevent James II from succeeding to the throne, but this bill was blocked by the House of Lords on two occasions. In the Spring of 1681, at the Oxford Parliament, Shaftesbury appealed to Charles II to legitimate Monmouth. Monmouth was caught preparing to rebel and seek the throne, and Shaftesbury was suspected of fostering this rebellion. The poem was written, possibly at Charles's behest, and published in early November 1681. On 24 November 1681, Shaftesbury was seized and charged with high treason. A trial before a jury picked by Whig sheriffs acquitted him.
Later, after the death of his father and unwilling to see his uncle James II become King, the Duke of Monmouth executed his plans and went into full revolt. The Monmouth Rebellion was put down, and in 1685 the Duke was executed.