After Mary II's death, William III continued to rule as King. Princess Anne's last living child, William, Duke of Gloucester, died in July 1700. Parliament saw that William would have no more children. Because of this, it passed the Act of Settlement 1701. After Anne, the Crown would go to their nearest Protestant relative, Sophia, Electress of Hanover, and her Protestant heirs. When William III died in 1702, he was succeeded by Anne. She was succeeded by the son of Electress Sophia, George I.