That posed a constitutional crisis in an era when monarchs actively led governments and religion was inextricably intertwined with government. Who would succeed the Protestant Anne as king of England, Scotland and Ireland?
Just 25 years earlier, Anne's father, King James II, a Catholic, was driven out of England in the Glorious Revolution of 1688-89. One of his major offenses: He appointed Catholics to local offices and made them military officers, claiming he could suspend the act of Parliament that required they be members of the Church of England.
The fear was that James would set up an absolutist government, ruling without parliament, just as the most powerful monarch of the day, Louis XIV, had done in France. James had not called a parliament in three years and abolished the colonial legislatures in what would become the United States.
The parliament that installed Anne's sister Mary and her husband (and first cousin), William of Orange, as queen and king got them to agree that monarchs could not suspend laws. That's the example the framers of the U.S. Constitution followed when they required presidents to faithfully execute the law.
After the Duke of Gloucester's death, parliament passed the Act of Settlement of 1701, which barred Catholics and anyone who married a Catholic from the throne. Left disinherited were the next 21 in line, including James' Catholic son, James Edward, who was 26 when Anne died.
Just before Anne died she dismissed her chief ministers, Lords Oxford and Bolingbroke, who had been scheming to have James Edward succeed her. In their place she appointed the Earl of Shrewsbury, a leader in the Glorious Revolution.
Anne's and perhaps England's greatest general, the Duke of Marlborough, organized military forces to repel any attempt to place James Edward on the throne. So when she died, the summons went out to her distant cousin, Georg Ludwig, the Elector of Hanover, the next Protestant in line, to come from Germany to London to be crowned.
And so he was, six weeks later. The Hanoverian succession, as historians call it, had been accomplished. A Jacobite army landed in Scotland in 1715 to install James Edward and landed there in 1745 to install his son, Bonnie Prince Charlie, but both were repulsed after initial victories.