Their main purpose was to exclude anyone not a member of the Church of England—the official state religion—from holding government office, notably Catholics and "nonconforming" Protestants.
In many cases the colonial governments established an official religion, requiring residents to adhere to the beliefs of the founding sect.
[1] With the royal government's religious favoritism fresh in their memory, the Founders sought to prevent the return of the Test Acts by adding this clause to the Constitution.
Specifically, Charles Pinckney, delegate from South Carolina—where a Protestant denomination was the established state religion—introduced the clause to Article VI, and it passed with little opposition.
In the case of Ex parte Garland, the Court overturned a loyalty oath that the government had tried to apply to pardoned Confederate officials.