In 1685, James II became King of England & Ireland, and, simultaneously, he was James VII of Scotland. His Catholicism created significant religious tensions in a predominantly Protestant nation, which eventually lead to the Glorious Revolution of 1688: fearing a Catholic dynasty after the birth of James's son in that year, a group of English nobles invited William of Orange, a Protestant and husband of James's daughter Mary, to invade England. Thus, James II was replaced by his protestant daughter, Mary II, and her husband, William of Orange (William III).
When they became joint monarchs, they agreed to the Bill of Rights (1689), which limited the powers of the monarchy and established the constitutional monarchy that endures in the UK to this day, which fundamentally shifted the balance of power in favor of Parliament. Given the fact that William & Mary had no surviving children, the Act of Settlement (1701) was passed to ensure that only Protestants could ascend the throne.
In 1707, the Act of Union was signed, uniting the kingdoms of England and Scotland into a single kingdom called Great Britain and Anne Stuart, the younger sister of Mary II, became the first monarch of Great Britain after this union (1702-1714). Her reign saw growing parliamentary power and the rise of party politics.