The Act of Settlement was established by English Parliament in 1701 to settle the question Quenn Anne's successor. As of today, the act is still valid in the United Kingdom.
The Act of Settlement states that after the death of Queen Anne, who was the last Prostestant in the House of Stuart, her succession would fall to the Protestant Sophie von der Pfalz. She was the closest, protestant relative to Royal Family that was still alive and the House of Hanover should therefore inherit the crown.
This act has kept catholics out of the British successors ever since.