When Charles II died without any children in 1685, the Duke of York became King as James II in England and Ireland. He also became James VII in Scotland. He tried to give freedom of religion to non-Anglicans. He did this by making the acts of Parliament invalid by Royal Decree. The public did not like this. Several Protestant politicians and noblemen entered into negotiations (trying to reach agreements through discussion) with Mary's husband as early as 1687. In May 1688, James forced Anglican clergymen to read the Declaration of Indulgence. The Declaration of Indulgence was a statement that gave religious freedom to those who did not agree with the Church of England. This made him much less popular. Protestants became even more fearful when his wife, Mary of Modena, gave birth to a son–James Francis Edward–in June 1688. They were fearful because the son would, unlike Mary and Anne, be raised a Roman Catholic. Some said that the boy had been secretly carried into the Queen's room in a bed-warming pan instead of her stillborn baby. There was no strong proof to support this story, but Mary publicly doubted the boy's legitimacy. She sent a list of suspicious questions to her sister, Anne, about the boy's birth.
On 30 June, the Immortal Seven secretly asked William, who was in the Netherlands with Mary, to come to England with an army. William, who was jealous of Mary's position and power, did not want to go at first. But Mary told William that she did not care about political power. She said "she would be no more but his wife, and that she would do all that lay in her power to make him King for life".
William agreed to attack. He declared that James' newborn son was the "pretended Prince of Wales". He also gave a list of what the English people wanted, and said that he only wanted to have "a free and lawful Parliament assembled". The Dutch army, which had been turned back by a storm in October, landed on 5 November. The English Army and Navy went over to William. At this time, the English people's confidence in James was very low. They did not even try to save their King. On 11 December, the King tried to run away, but failed. He tried to run away again on 23 December. This second attempt was successful, and James escaped to France. He lived there in exile until his death.
Though Mary was sad because of the deposition of her father, William ordered her to look happy when they arrived in London. Because of this, people thought she was being cold to her father. James also thought his daughter was unfaithful to him. This hurt Mary deeply.
In 1689, a Convention Parliament called by the Prince of Orange came together to discuss what they should do. William of Orange felt uncomfortable about his position. He wanted to rule as a King, not simply as a husband of a Queen. The only example of joint monarchy was from the sixteenth century. This was Queen Mary I and the Spanish Prince Philip. When they married, it was agreed that Prince Philip would take the title of King. But Philip II was King only during his wife's lifetime. He also did not have much power. William wanted to remain King even after his wife's death. Some important people suggested making Mary the only ruler. But Mary, who was faithful to her husband, refused.
On 13 February 1689, Parliament passed the Declaration of Right. In this declaration, it said that James, by trying to run away on 11 December 1688, had abandoned the government, so no one at the time was king. Normally, James's oldest son, James Francis Edward would have been the heir. However, Parliament offered the crown to William and Mary as joint Sovereigns instead. But it was added that "the sole and full exercise of the regal (royal) power be only in and executed by the said Prince of Orange in the names of the said Prince and Princess during their joint lives." The declaration was later extended to take out all Catholics. This was because "it hath been found (discovered) by experience that it is inconsistent (not in harmony) with the safety and welfare of this Protestant kingdom to be governed by a papist prince".
William and Mary were crowned together at Westminster Abbey on 11 April 1689. The Archbishop of Canterbury usually performed coronations. But William Sancroft, the Archbishop at that time, felt that James II's removal had been wrong. Therefore, the Bishop of London, Henry Compton, crowned them instead. On the day of the Coronation, the Convention of the Estates of Scotland declared at last that James was no longer King of Scotland. William and Mary were offered the separate Scottish Crown. This was because the two kingdoms were not united until the Acts of Union in 1707. They accepted on 11 May.
Even after this was declared, there was still strong support for James in Scotland. John Graham of Clevehouse, the Viscount of Dundee, raised an army and won a victory at Killiecrankie on 27 July. But Dundee's army suffered great losses, and he was seriously wounded at the start of the battle. This stopped the only effective resistance to William, and the revolt was quickly crushed. The next month, there was a great defeat at the Battle of Dunkeld.
In December 1689 Parliament passed one of the most important documents in English history. This was the Bill of Rights. This measure gave several rights to Parliament and the people. Among other things, it declared that the Sovereign could not break laws passed by Parliament, demand taxes if the Parliament did not agree, raise an army during a time of peace if the Parliament did not agree, or punish members of the House of Parliament for anything they said during discussions.
After either William III or Mary II died, the other was to continue to rule. The person who would become the monarch after them would be any of their children. After the children would be Mary's sister Anne and her children. Last of all would be any children William III might have had from any marriage after that.
From 1690, William was often away from England, at first fighting Jacobites in Ireland. While her husband was away, Mary took care of the government. She was a firm ruler, and ordered her own uncle, Henry Hyde, 2nd Earl of Clarendon, to go to prison for trying to put James II back onto the throne. In 1692, she fired and put John Churchill, 1st Duke of Marlborough, in prison for similar reasons. This made her much less popular. It also damaged her relationship with her sister, Anne. Anne had been strongly influenced by Churchill's wife, Sarah. She appeared at court with Sarah and supported Churchill, which made Mary very angry. She demanded that Anne make Sarah go away. Mary did not visit Anne during her pregnancy after that. After the baby was born, Mary did visit Anne, but she spent her time berating Anne for her friendship with Sarah. The sisters never saw each other again.
William had crushed the Irish Jacobites by 1692, but he continued with campaigns away from England to begin a war against France in the Netherlands. When William was away, Mary acted in her own name but on his advice. When he was in England, Mary never joined in political matters, as had been agreed in the Bill of Rights. However, she did join in the affairs of the Church, and all church matters passed through her hands.
Mary died of smallpox at Kensington Palace on 28 December 1694. She was buried at Westminster Abbey. When she died, Henry Purcell was called to write her funeral music, titled "Music for the Funeral of Queen Mary". William had grown to depend on Mary more and more, and was very sad when she died. It is reported that he said that "from being the happiest" he was "now going to be the miserablest creature on earth".