For many a year, here in the UK, we had the Test Acts (Corporation Act 1661 and the Test Acts of Acts of 1973 and 1678), instituted originally for fear of Catholic subversion, as in the Gunpowder Plot of 1605 and later the fictitious 'Popish Plot' , supposedly reveaeld by Titus Oates in the 1670s. But they remained on the Statute Books until the late 1800s becuase there was a general feeling that Roman Catholics owed an allegiance to the Pope (a foreigngruler) that overrode their loyalty to the Crown and their country.
Unfortunately, the Acts were too broad in scope, in that they denied political office and jobs in government service to Nonconformists as well as Catholics. By the 19th Century, however, the numbers of Catholics in most of Britain (excepting, as always, Ireland) had declined, while the number of Nonconformists (especially among the emergent urban middle-classes) had grown to at least equal the number of Anglicans. Thus a series of Acts in the mid 19th Century gradually removex the constraints on the 'Free Churches'. With this done, by the latter part of the Century, there was deemed to be no reason to maintain the constraints on Catholics.